The EGL system code assumes a default mapping between EGL types and SQL types. The system code uses the mapping at declaration time, validation time, and run time. For a table showing that mapping, see "Retrieving SQL table data."
To override this default mapping in DB2®, you can use the SQL field level sqlDataCode property. This property was necessary in code migrated from VisualAge Generator, which lacked equivalents for many current EGL data types. The property is maintained primarily for compatibility with earlier product versions.
Record ExampleSQLRecord type SQLRecord
myHexVar HEX(8) {sqlDataCode = 497}; // matches SQL INTEGER
end
The following table shows sqlDataCode values in DB2 for the various SQL data types.
| SQL data type | sqlDataCode |
|---|---|
| BIGINT | 492, 493 |
| BIT | n/a in DB2 |
| BLOB | 404, 405 |
| BOOLEAN | n/a in DB2 |
| CHAR | 452, 453 |
| CLOB | 408, 409 |
| DATE | 384, 385 |
| DECIMAL | 484, 485 |
| DOUBLE | 480, 481 |
| FLOAT | 480, 481 |
| GRAPHIC | 468, 469 |
| INTEGER | 496, 497 |
| LONG VARBINARY | 480, 481 |
| LONG VARCHAR | 456, 457 |
| LONG VARGRAPHIC | 472, 473 |
| NUMERIC | 484, 485 |
| REAL | 480, 481 |
| SMALLINT | 500, 501 |
| TIME | 388, 389 |
| TIMESTAMP | 392, 393 |
| VARBINARY | 480, 481 |
| VARCHAR | 448, 449 |
| VARGRAPHIC | 464, 465 |
The first of each number pair represents a column defined as NOT NULL. To determine whether a variable is nullable, the EGL system code relies on the ? modifier or on the property isSQLNullable, not on the SQL data code.