NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
L-40
Considerations—LOAD
stored in four bytes. SQL stores only the portion of the DATETIME field that is
declared for the column.
The following example specifies a value of 1993-03-01 for a DATETIME
YEAR TO DAY column:
FIRST KEY (7,201,3,1)
The value 7,201 for the year 1993 is obtained by dividing by 256 and using
remainders, as described in the preceding binary column discussion.
°
To specify a value for an INTERVAL column, first determine the number of
bytes required. Find the entry for the column in the COLUMNS catalog table.
Do not use INVOKE output; this does not describe the internal representation of
the column. Next, form the value as described for SMALLINT, INTEGER, or
LARGEINT columns, expressed as a multiple of the smallest unit in the
interval.
°
To specify a value for a floating point column, you must convert the floating
point value into a series of bytes. One way to do this is to write a program that
redefines a floating point variable as an array of bytes. Store the desired floating
point value into the variable, and then use the byte values from the array of
bytes for the FIRST KEY specification.
Using the FIRST key-specifier ALTKEY option
The following considerations apply to the use of the FIRST key-specifier
ALTKEY option:
°
For nonunique alternate keys, the key includes the primary key after the last
column of the alternate key. You do not need to include primary key values in
your specification unless you want to include enough of the primary key value
to distinguish a specific row.
°
To specify the value of an alternate key columns that is nullable, include two
bytes with the value 0 (for the null indicator), followed by the internal
representation for the alternate key value as described previously in Using the
FIRST KEY Option.
The following example specifies an alternate key value of “KAQB” for a
nullable PIC X(4) column:
FIRST keyspec ALTKEY (0,0,"KAQB")
°
To specify a null alternate key value, include two bytes with the value 255
followed by as many bytes with value 0 as needed to complete the column
value.
The following example specifies an null value for a nullable PIC X(4) alternate
key column:
FIRST keyspec ALTKEY (255,255,0,0,0,0)