This topic lists the data type encodings used by the database and the embedded SQL preprocessor.
The database returns these values to the SQLDA specified by the application with a PREPARE or DESCRIBE statement.
The preprocessor uses these values for both input and output SQLDA fields generated by the precompiler and recognized at execution.
Locating Data Type Encodings
A data type encoding is contained in the two byte SQLTYPE INTEGER subfield of the SQLVAR field in the SQLDA.
How to Interpret The Nullability of SQL Data Type Encodings
Use these guidelines to interpret the tables in SQL Data Type Encodings and Unused and Internally Used SQL Data Type Encodings.
IF the code is … | THEN … |
---|---|
nullable | indicator variables are allowed. |
non-nullable | no indicator variables are allowed. |
SQL Data Type Encodings
The rules for determining each encoding, given the non-nullable encoding for the data type, are as follows.
TO determine this encoding … | ADD this value to the non-nullable encoding for the data type … |
---|---|
nullable | 1 |
stored procedure IN parameter | 500 |
stored procedure INOUT parameter | 501 |
stored procedure OUT parameter | 502 |
The following table lists the SQL data types and their SQLDA data type encodings.
Data Type | Data Type Encodings | ||||
---|---|---|---|---|---|
Non-Nullable | Nullable | IN | INOUT | OUT | |
BYTEINT | 756 | 757 | 1256 | 1257 | 1258 |
SMALLINT | 500 | 501 | 1000 | 1001 | 1002 |
INTEGER | 496 | 497 | 996 | 997 | 998 |
BIGINT | 600 | 601 | 1100 | 1101 | 1102 |
DECIMAL | 484 | 485 | 984 | 985 | 986 |
FLOAT/REAL/DOUBLE PRECISION | 480 | 481 | 980 | 981 | 982 |
BYTE | 692 | 693 | 1192 | 1193 | 1194 |
VARBYTE | 688 | 689 | 1188 | 1189 | 1190 |
LONG VARBYTE | 696 | 697 | 1192 | 1193 | 1194 |
BLOB | 400 | 401 | 900 | 901 | 902 |
BLOB AS DEFERRED | 404 | 405 | 904 | 905 | 906 |
BLOB AS LOCATOR | 408 | 409 | 908 | 909 | 910 |
BLOB AS DEFERRED BY NAME | 412 | 413 | 912 | 913 | 914 |
DATE (DateForm=ANSIDate) | 748 | 749 | 1248 | 1249 | 1250 |
DATE (DateForm=IntegerDate) | 752 | 753 | 1252 | 1253 | 1254 |
TIME | 760 | 761 | 1260 | 1261 | 1262 |
TIMESTAMP | 764 | 765 | 1264 | 1265 | 1266 |
TIME WITH TIME ZONE | 768 | 769 | 1268 | 1269 | 1270 |
TIMESTAMP WITH TIME ZONE | 772 | 773 | 1272 | 1273 | 1274 |
INTERVAL YEAR | 776 | 777 | 1276 | 1277 | 1278 |
INTERVAL YEAR TO MONTH | 780 | 781 | 1280 | 1281 | 1282 |
INTERVAL MONTH | 784 | 785 | 1284 | 1285 | 1286 |
INTERVAL DAY | 788 | 789 | 1288 | 1289 | 1290 |
INTERVAL DAY TO HOUR | 792 | 793 | 1292 | 1293 | 1294 |
INTERVAL DAY TO MINUTE | 796 | 797 | 1296 | 1297 | 1298 |
INTERVAL DAY TO SECOND | 800 | 801 | 1300 | 1301 | 1302 |
INTERVAL HOUR | 804 | 805 | 1304 | 1305 | 1306 |
INTERVAL HOUR TO MINUTE | 808 | 809 | 1308 | 1309 | 1310 |
INTERVAL HOUR TO SECOND | 812 | 813 | 1312 | 1313 | 1314 |
INTERVAL MINUTE | 816 | 817 | 1316 | 1317 | 1318 |
INTERVAL MINUTE TO SECOND | 820 | 821 | 1320 | 1321 | 1322 |
INTERVAL SECOND | 824 | 825 | 1324 | 1325 | 1326 |
CHARACTER | 452 | 453 | 952 | 953 | 954 |
VARCHARACTER | 448 | 449 | 948 | 949 | 950 |
LONG VARCHARACTER | 456 | 457 | 956 | 957 | 958 |
CLOB | 416 | 417 | 916 | 917 | 918 |
CLOB AS DEFERRED | 420 | 421 | 920 | 921 | 922 |
CLOB AS LOCATOR | 424 | 425 | 924 | 925 | 926 |
CLOB AS DEFERRED BY NAME | 428 | 429 | 928 | 929 | 930 |
JSON Data Inline | 880 | 881 | 1380 | 1381 | 1382 |
JSON Data Locator | 884 | 885 | 1384 | 1385 | 1386 |
JSON Data Deferred | 888 | 889 | 1388 | 1389 | 1390 |
GRAPHIC | 468 | 469 | 968 | 969 | 970 |
VARGRAPHIC | 464 | 465 | 964 | 965 | 966 |
LONG VARCHAR CHARACTER SET GRAPHIC | 472 | 473 | 972 | 973 | 974 |
1-D ARRAY | 504 | 505 | 1004 | 1005 | 1006 |
n-D Array | 508 | 509 | 1008 | 1009 | 1010 |
UDT (both distinct and structured types) | not supported |
Unused and Internally Used SQL Data Type Encodings
The following table lists SQLDA data type codes that are either not used or are used internally so are not user-visible.
Data Type | Data Type Encodings | ||||
---|---|---|---|---|---|
Non-Nullable | Nullable | IN | INOUT | OUT | |
ZONED DECIMAL (sign trailing) | 432 | 433 | 932 | 933 | 934 |
ZONED DECIMAL (sign trailing separate) | 436 | 437 | 936 | 937 | 938 |
ZONED DECIMAL (sign leading) | 440 | 441 | 940 | 941 | 942 |
ZONED DECIMAL (sign leading separate) | 444 | 445 | 944 | 945 | 946 |
The rules for determining each encoding, given the non-nullable encoding for the data type, are the same as those listed in SQL Data Type Encodings.