Bulk-insert is used for creating bulk records by means of a programmatic syntax. The DataServer client component caches the record(s), and then send it to the Oracle database once the cache is full. The following statements can be used with send-sql-statement when you want records to be created in Bulk-insert mode:

  • ("--Bulk-insert Start <n>”): This statement is used to begin the Bulk-insert process, where <n> is optional.
  • CREATE
  • ("--Bulk-insert End"): This statement is used to end the Bulk-insert process.

For example:

RUN STORED-PROC send-sql-statement h1 = PROC-HANDLE ("--Bulk-insert Start
        10").
CLOSE STORED-PROC send-sql-statement r1 = PROC-STATUS WHERE PROC-HANDLE = h1.
  DO I = 1001 to 1040:
  CREATE customer.
  ASSIGN cust-num = i.
  ASSIGN NAME = "Bulk cust " + STRING (i).
  IF I > 1020 THEN
  comments = "asjkasdjkakjdjaksdjaks jkasdjk".
  IF I = 1035 THEN
  comments = FILL("asdf ", 1000).
  END.
  RELEASE customer. /* Flush out the last one before --Bulk-insert End */
RUN STORED-PROC send-sql-statement h2= PROC-HANDLE ("--Bulk-insert End").
CLOSE STORED-PROC send-sql-statement r2 = PROC-STATUS WHERE PROC-HANDLE = h2.
DISPLAY ERROR-STATUS:ERROR.
DISPLAY ERROR-STATUS:GET-MESSAGE(1) FORMAT "x(60)" ERROR-STATUS:GET-NUMBER(1).

The value after Bulk-insert Start is the number of records after which records will be created on Oracle Database. In case, the number of records is not specified, Bulk-insert will fill up a buffer that ABL Client uses for keeping the records. When the buffer is filled up, records will be created. In that case, Bulk-insert End will just write the remaining records in the buffer that haven’t been created.

Batch size is minimum of number you specify on Bulk-insert Start or the number of records that can be put it in the bulk insert cache( which is 30k).

Note: Whenever there is a LOB operation inside Bulk Insert then, Bulk Insert will be downgraded to single record insert.