Background documentationImporting Constants and Special Constants Locate this document in the navigation structure

 

In column descriptions, you can use the syntax rule column_assignment to specify that a constant or a special constant should be imported into the specified column for each imported data record, instead of the value from the data stream.

Structure

Syntax Syntax

  1. <column_assignment> ::=
      <column_name> '<literal>'
    | <column_name> <column_function>
    
    <column_function> ::=
      DATE
    | FALSE
    | STAMP
    | TIME
    | TIMESTAMP
    | TRUE
    | USER
    | USERGROUP
    | <sequence_number>
    <sequence_number> ::=
      SEQNO
    | SEQNO <integer>
    | SEQNO <integer> <integer>
End of the code.
column_function

DATE

Current date: The column into which you want to import one of these values must have type DATE

FALSE

Boolean value FALSE

STAMP

Unique value generated by the database system. Can only be imported into columns of type CHAR (n) BYTE where n >= 8

TIME

Current time: The column into which you want to import one of these values must have type TIME

TIMESTAMP

Current time stamp: The column into which you want to import one of these values must have type TIMESTAMP

TRUE

Boolean value TRUE

USER

Name of the current user

USERGROUP

Name of the group of the current user: If this user is not assigned to a user group, the name of the current user is imported; the column into which you want to import one of these values must have type CHAR (n) where n >= 32

SEQNO

Sequence number: The initial number is 0 and each time the number is increased by 1

SEQNO <integer>

Sequence number: The initial number is the specified integer; each time the number is increased by 1

SEQNO <integer> <integer>

Sequence number: The initial number is specified immediately following the keyword SEQNO. The next integer specifies the interval between the values to be imported.

In the Loader command, enter the constant literal or the special constant column_function instead of a position specification. Data is not imported from the data stream for the relevant column.

Note Note

If the data stream is empty, the constants specified in the command are not imported.

End of the note.
<column_name> '<literal>'

To import a general constant literal, enter the required constant instead of a position. Place the value in single quotation marks. Loader treats the constant like a plain text value and converts it into the data type of the target column. If you want to import the constant into a numeric column, it must have a valid numeric format.

<column_name> <column_function>

You can import special column_function constants. The following values are possible: DATE, FALSE, STAMP, TIME, TIMESTAMP, TRUE, USER, USERGROUP and sequence_number.

<sequence_number>

You can use the syntax rule sequence_number to import number generators with any initial number and increment. The numbers you calculate are cyclical. This means that the value following the largest possible value is the smallest possible value. In this way, you can generate as many numbers as you want, including repeated sequential numbers. If you use the sequence_number syntax rule, sequential numbers should be generated according to one of the three options. Both the initial value and the increment can be negative. A column of type FIXED(10) is usually sufficient for storing the sequential numbers.

Example

Example Example

IMPORT TABLE hotel.reservation

DATA INSTREAM 'reservation_csv.data'

  rno        1

  cno        2

  hno        3

  type       4

  arrival    '20040207'

  departure  '20040220'

End of the example.

Constants 20040207 and 20040220 (date in INTERNAL format) are imported.

Example Example

IMPORT TABLE hotel.reservation

DATA INSTREAM 'reservation_csv.data'

  rno        1

  cno        2

  hno        3

  type       4

  arrival    DATE

  departure   6

End of the example.

The special constant DATE is imported.

Example Example

IMPORT TABLE hotel.customer

DATA INSTREAM 'customer_csv.data'

  cno        SEQNO 3000 100

  title     2

  firstname  3

  name      4

  zip       5

  address    6

End of the example.

The specifications for the sequence (initial position 3000, interval 100) are imported.