Entering content frame

Syntax documentation Importing Constants and Special Constants Locate the document in the library structure

For column descriptions, you can use the syntax rule column_assignment to specify that a constant value is imported into the specified column for each imported data record, and which value this constant is to have.

In the command, enter any constant valLITERAL or the special constant generate_spec instead of a position specification. Now, data will not be imported from the data stream for the appropriate column.

Note

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

Syntax

<column_assignment> ::= <valCOLUMN_NAME> '<valLITERAL>'
| <valCOLUMN_NAME> <generate_spec>

<valCOLUMN_NAME>

Name of column

<valLITERAL>

Constant

<generate_spec>

DATE | FALSE | <sequence_number> | STAMP
| TIME | TIMESTAMP | TRUE | USER | USERGROUP

DATE

Current date

The column into which you want to import one of these values must have the type DATE.

FALSE

Boolean value FALSE

<sequence_number>

SEQNO | SEQNO <valSTART> | SEQNO <valSTART> <valINCREMENT>

<valSTART>

Start value and first value to be imported

<valINCREMENT>

Increment between values to be imported

STAMP

A unique value generated by the database system that can only be imported into columns of the type CHAR (n) BYTE where n >= 8.

TIME

Current time

The column into which you want to import one of these values must have the type TIME.

TIMESTAMP

Current timestamp

The column into which you want to import one of these values must have the type TIMESTAMP.

TRUE

Boolean value TRUE

USER

The name of the current user is imported.

USERGROUP

Name of the group of the current user is imported.

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 the type CHAR (n) where n >= 32.

Examples

Example

IMPORT TABLE hotel.reservation
DATA INSTREAM FILE 'reservation.data'
  rno        1
  cno        2
  hno        3
  type       4
  arrival    '20040207'
  departure  '20040220'

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

Example

IMPORT TABLE hotel.reservation
DATA INSTREAM FILE 'reservation.data'
  rno        1
  cno        2
  hno        3
  type       4
  arrival    DATE
  departure  5

The special constant DATE is imported.

Example

IMPORT TABLE hotel.customer
DATA INSTREAM FILE 'customer.data'
  cno       
SEQNO 3000 100
  title     2
  firstname 3
  name      4
  zip       5
  address   6

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

Explanation

<valCOLUMN_NAME> '<valLITERAL>'

To import general constant, enter the required constant instead of a position. Place the value in single quotation marks.

The 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.

<valCOLUMN_NAME> <generate_spec>

You can import the special values USER, USERGROUP, DATE, TIME, TIMESTAMP, STAMP, TRUE, FALSE and sequence_number.

<sequence_number>

You can use the syntax rule sequence_number to import automatically generated number generators with a freely definable start value and increment.

The set of calculable numbers is cyclical. This means that the value that comes after 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.

SEQNO: sequential numbers are to be generated. Both the start value and the increment can be negative.

If you only enter the keyword SEQNO in the command, the start value is 0 and the increment between values is 1.

If you only enter the start value in the command after SEQNO, the increment between the values is 1.

A column of the type FIXED(10) is enough for storing the sequential numbers.

 

Leaving content frame