Entering content frame

Background documentation DATALOAD Command Locate the document in its SAP Library structure

You can use this Loader command to control the loading of application data.

Prerequisites

The table exists in the database instance. Otherwise, it must be created before the DATALOAD command is executed.

Syntax

<dataload_command> ::=
DATALOAD TABLE <table_spec> [<duplicates_clause>] <load_column_spec_mlt> <instream_spec> [<longfile_spec_mlt>]

<duplicates_clause> ::= IGNORE DUPLICATES | REJECT DUPLICATES | UPDATE DUPLICATES

IGNORE DUPLICATES

The new line is not inserted.

REJECT DUPLICATES

The new line is rejected with an error message.

UPDATE DUPLICATES

The new line overwrites the existing line.

You can also use the keywords LOAD DATA instead of the keyword DATALOAD.

Example

DATALOAD TABLE customer
  cno         01-05
  title       06-12
  firstname   13-22
  name        23-32
  zip         33-37
  address     38-62
INSTREAM 'customer.data' FORMATTED

Example

DATALOAD TABLE room
  hno         1
  type        2
  free        3
  price       4
INSTREAM 'room.data'

Example

DATALOAD TABLE reservation
IF POS 5 >= '11.08.2095'
  rno        1
  cno        2
  hno        3
  type       4
  arrival    5
  departure  6
INSTREAM 'reservation.data'
DATE 'tt.mm.jjjj' DECIMAL '/ /./'

Example

DATALOAD TABLE room
IF (POS 17-24 REAL <= '400.00')
    AND
   (POS 17-24 REAL >= '100.00')
  hno         01-05
  type        06-12
  free        13-16
  price       17-24 REAL NULL IF POS 17-24 = '0'
INSTREAM 'room.data'
FORMATTED BINARY
NULL '?'

Explanation

Like the FASTLOAD command, the DATALOAD command reads data from a data stream and writes it to the tables of a database instance.

DATALOAD commands are processed while the database is running.

Note

A DATALOAD process lasts longer in total than a FASTLOAD process. The writing of the log entries, in particular, can lead to a loss of performance. If errors occur, you can undo DATALOAD entries, since the log entries can be evaluated.

Process Flow

The Loader generates an internal mass INSERT statement from the DATALOAD command and then executes it.

During the load operation, all of the tables modified by this DATALOAD command can also be read and changed by other users.

<duplicates_clause>

You use the DUPLICATES clause duplicates_clause to specify how to proceed when loading data from a data stream if a row with the same key as the new row already exists in the table.

If you do not specify anything, REJECT DUPLICATES is the default.

Example

DATALOAD TABLE customer
  UPDATE DUPLICATES
  cno           01-05
  title         06-12
  name          13-22
  zip           23-27
  address       28-51
INSTREAM 'customer.data' FORMATTED

Result

The data in the data stream has been loaded to the target table(s). All the changes made to the target table(s) as a result have also been written to the log area of the database instance.

Errors

If the load operation cannot be ended successfully, the Loader logs the last row that was inserted successfully in the table, the number of rows inserted, and the number of rows rejected in the log file.

 

Leaving content frame