Supported SQL data types in FORTRAN embedded SQL applications
Certain predefined FORTRAN data types correspond to Db2® database column
types. You can declare only these FORTRAN data types as host variables.
The following table shows the FORTRAN equivalent of each column type. When the precompiler finds a host variable declaration, it determines the appropriate SQL type value. The database manager uses this value to convert the data exchanged between the application and itself.
SQL Column Type1 | FORTRAN Data Type | SQL Column Type Description |
---|---|---|
SMALLINT
(500 or 501) |
INTEGER*2 | 16-bit, signed integer |
INTEGER
(496 or 497) |
INTEGER*4 | 32-bit, signed integer |
REAL2
(480 or 481) |
REAL*4 | Single precision floating point |
DOUBLE3
(480 or 481) |
REAL*8 | Double precision floating point |
DECIMAL(p,s)
(484 or 485) |
No exact equivalent; use REAL*8 | Packed decimal |
CHAR(n)
(452 or 453) |
CHARACTER*n | Fixed-length character string of length n where n is from 1 to 254 |
VARCHAR(n)
(448 or 449) |
SQL TYPE IS VARCHAR(n) where n is from 1 to 32 672 | Variable-length character string |
LONG VARCHAR5
(456 or 457) |
SQL TYPE IS VARCHAR(n) where n is from 32 673 to 32 700 | Long variable-length character string |
CLOB(n)
(408 or 409) |
SQL TYPE IS CLOB (n) where n is from 1 to 2 147 483 647 | Large object variable-length character string |
CLOB locator variable4
(964 or 965) |
SQL TYPE IS CLOB_LOCATOR | Identifies CLOB entities residing on the server |
CLOB file reference variable4
(920 or 921) |
SQL TYPE IS CLOB_FILE | Descriptor for file containing CLOB data |
BLOB(n)
(404 or 405) |
SQL TYPE IS BLOB(n) where n is from 1 to 2 147 483 647 | Large object variable-length binary string |
BLOB locator variable4
(960 or 961) |
SQL TYPE IS BLOB_LOCATOR | Identifies BLOB entities on the server |
BLOB file reference variable4
(916 or 917) |
SQL TYPE IS BLOB_FILE | Descriptor for the file containing BLOB data |
DATE
(384 or 385) |
CHARACTER*10 | 10-byte character string |
TIME
(388 or 389) |
CHARACTER*8 | 8-byte character string |
TIMESTAMP(p)
(392 or 393) |
CHARACTER*19 to CHARACTER*32 | 19 to 32 byte character string |
XML
(988 or 989) |
SQL_TYP_XML
|
There is no XML support for FORTRAN; applications are able to get the describe type back but will not be able to make use of it. |
Note:
|
The rule for supported FORTRAN data types is:
- You can define dynamic SQL statements longer than 254 characters by using VARCHAR, or CLOB host variables.