The meanings of SQLTYPE values depend on the type of statement executed, as shown in the table below. The following differences should be noted:
The codes for DB2 mode differ depending on whether or not null values are allowed in the column. An even value for SQLTYPE indicates that the column does not allow nulls. An odd value indicates that the column does allow nulls. In XDB mode, the codes do not differ.
Codes differ depending on whether or not indicator variables are provided for use with the host variable. An even value for SQLTYPE means no indicator variable is provided, an odd value indicates that SQLIND contains the address of an indicator variable.
In addition, because host variables do not include DATE, TIME or TIMESTAMP data types, these values are usually retrieved using fixed length character strings.
Data Type | DESCRIBE & PREPARE | FETCH, OPEN & EXECUTE | |||
---|---|---|---|---|---|
DB2 Mode: | XDB Mode | No Indicator | Indicator | ||
date (See note 1.) |
384 | 385 | 4 | 384 | 385 |
time (See note 1.) |
388 | 389 | 7 | 388 | 389 |
timestamp (See note 1.) |
392 | 393 | 11 | 392 | 393 |
varying-length character string | 448 | 449 | 9 | 448 | 449 |
fixed-length character string | 452 | 453 | 6 | 452 | 453 |
long varying length character string | 456 | 457 | 10 | 456 | 457 |
varying length graphic string | 464 | 465 | 17 | 464 | 465 |
fixed length graphic string | 468 | 469 | 16 | 468 | 469 |
long varying length graphic string (See note 2.) |
472 | 473 | 22 | 472 | 473 |
floating point | 480 | 481 | 3 | 480 | 481 |
packed decimal | 484 | 485 | 8 | 484 | 485 |
money | 484 | 485 | 5 | 484 | 485 |
large integer | 496 | 497 | 2 | 496 | 497 |
small integer | 500 | 501 | 1 | 500 | 501 |
Table Notes: