KCML Datatypes

This table shows the mapping between SQL data types that can be used in a CREATE TABLE statement and the old Rev7 .dd dictionary codes. Note that the data type specifies the TYPE, LENGTH, PIMAGE dictionary fields in combination with an optional SIGNED or UNSIGNED attributes. Packed numbers are to be assumed to be SIGNED however this can be overridden by the explicit attribute. Integers are assumed UNSIGNED unless the SIGNED attribute

The precision prec defines the number of digits in total and the scale scale determines how many are after the decimal.

Rev7 dictionary codeKDB SQL typeFLD typePurpose
CCHAR(len)CHAR(len)Fixed size strings of any size.
VVARCHAR(len)CHAR(len)Variable length strings of any size. NULL if blank
PNUMERIC(prec[, scale])NUM(prec[, scale])KCML packed numbers.
BINTEGER[(size)]INT(size)
UINT(size)
Integers 1-4 bytes. Represented in Oracle by NUMBER(n) where n is 3,5,9 or 11 respectively.
JDATEDATEA date represented as a Julian date in an unsigned integer of 3 bytes. A zero value is considered to be NULL
HHEX(len)HEX(len)A binary datatype.
FBITThe logical type is a synthetic type generated whenever a column is of type VARCHAR, has width 1 and permits only the values Y, N or blank. A blank value is considered to be NULL.
GBOOLBOOLBOOLEAN 'Y', '1' or N' '0' held as a single byte
LBCDDATEA 3 byte YYMMDD packed date or a 4 byte CCYYMMDD packed date
KDECIMAL(prec[, scale])IBM packed numbers
TTIMETIMETime since midnight local time in seconds as an unsigned integer in 3 bytes.
MTIMESTAMPTIMESTAMPTime in milliseconds since 00:00 GMT year 0000, as an unsigned integer in 6 bytes.
QBLOBBIDBLOB - Binary Large OBject
OCLOBCharacter BLOB

Variable length VARCHAR strings are only supported for SQL databases where the length is interpreted as a maximum. Such strings are space filled when read from the database and trailing blanks are clipped before writing to the database. A blank variable length string is held in the database as a NULL. Variable length strings are only allowed in index columns if the column is declared as NOT NULL in the CREATE TABLE thus disallowing blank values. VARCHAR can be used in word indexed columns without this restriction.

VARCHAR2 is a synonym for VARCHAR. The native KDB database considers CHAR and VARCHAR to be the same fixed length string datatype.

CHAR and VARCHAR types must be UTF-8 encoded. Oracle databases must be created with UTF-8 encoding.