In the Loader code specification, you can define the default code type for interpreting data streams that contain plain text values.
You can determine code specifications for a Loader session using the SET command to define the data format
Syntax
<set_codetype_command> ::= SET CODETYPE <standard_code_spec> <standard_code_spec> ::= ASCII | UCS2 | UTF8
You can determine code specifications for a Loader command using syntax rule code_spec for data format (see: field_format_spec in data format).
Syntax
<code_spec> ::= <standard_code_spec> | CODESET <literal> <standard_code_spec> ::= ASCII | UCS2 | UTF8
When using LOB data, you can determine the code specification using syntax rule lob_code_spec (see: Exporting and Importing LOB values).
Syntax
<lob_code_spec> ::= <code_spec> | BINARY
ASCII |
Code type for interpreting data streams is ASCII. The Loader default value is ASCII. |
UCS2 |
Code type for interpreting data streams is UCS2. |
UTF8 |
Code type for interpreting data streams is UTF8. |
BINARY |
Specifying code type BINARY is only useful for columns of data type LOB BYTE. Data is exported/imported without being converted. |
If the code specification is missing in the Loader command, Loader uses the code type defined by the SET CODETYPE command or a default value.
SET CODETYPE command: This setting applies to the entire Loader session if the character strings are not changed by another SET CODETYPE command. You can change the current value for individual Loader commands using the syntax element code_spec to define the data format.
Default value: This value is derived from the internal database data type of the column to be imported. If the internal database data type and the code specified for the data streams are different, Loader converts the data. If the data base type and the code specification are incompatible, Loader generates an error message and stops processing the command.
When exporting or importing data, you can transform the data between various code types. If you export/import ASCII data into an ASCII database or UCS2 data into a UNICODE database, the data does not have to be converted. The following combinations are possible (internal and external database data types):
Internal Database Data Type |
Possible Code Specifications for Data Streams with Clear Text Values when Exporting Data |
---|---|
(VAR)CHAR ASCII |
ASCII, UCS2, UTF8 |
(VAR)CHAR UNICODE |
UCS2, UTF8 |
(VAR)CHAR BYTE |
BINARY, ASCII (HEX), UCS2 (HEX), UTF8 (HEX) |
Numeric data types |
ASCII, UCS2, UTF8 |
Internal Database Data Type |
Possible Code Specifications for Data Streams with Clear Text Values when Importing Data |
---|---|
(VAR)CHAR ASCII |
ASCII |
(VAR)CHAR UNICODE |
ASCII, UCS2, UTF8 |
(VAR)CHAR BYTE |
BINARY, ASCII, UCS2 (HEX), UTF8 (HEX) |
Numeric data types |
ASCII, UCS2, UTF8 |
When exporting or importing LOB data, you define the default code types using the syntax rule lob_code_spec. This enables you to convert LOB data between various code types. If you are exporting/importing ASCII LOB data into an ASCII database or UCS2 LOB data into a UNICODE database, the data does not have to be converted. The following combinations are possible (internal and external database data types):
Internal Database Data Type |
Possible Code Specifications for the Data Stream when Exporting Data |
---|---|
CLOB [ASCII] |
ASCII, UCS2, UTF8 |
CLOB UNICODE |
UCS2, UTF8 |
BLOB |
BINARY, ASCII (HEX), UCS2 (HEX), UTF8 (HEX) |
Internal Database Data Type |
Possible Code Specifications for the Data Stream when Importing Data |
---|---|
CLOB [ASCII] |
ASCII |
CLOB UNICODE |
ASCII, UCS2, UTF8 |
BLOB |
BINARY, ASCII, UCS2 (HEX), UTF8 (HEX) |
SQL Reference Manual, Data Type (data_type)