loadTable()

The sqlLib.loadTable() system function loads data from a file into a relational database. The function is available only for EGL-generated Java™ programs.

To unload information from a relational database table and insert it into a file, use the sqlLib.unloadTable() function.

Syntax

  sqlLib.loadTable(
    fileName STRING in,
    insertIntoClause STRING in
    [, delimiter STRING in
    ])
fileName
The name of the file from which data is loaded. The name is fully qualified or is relative to the directory from which the program is invoked.
insertIntoClause
Specify the table and columns where the data resides. Use the syntax of an INSERT clause in an SQL INSERT statement, as in this example:
  "INSERT INTO myTable(column1, column2)"
The following example clause is sufficient if the file includes values for all table columns in column order:
  "INSERT INTO myTable"
delimiter
Specifies the symbol that separates one value from the next in the file. (One row of data must be separated from the next by the newline character.)

The default symbol for delimiter is the value in the vgj.default.databaseDelimiter Java runtime property, and the default value for that property is a pipe (|).

The following symbols are not available:
  • Hexadecimal characters (0 through 9, a through f, A through F)
  • Backslash (\)
  • The newline character or Ctrl+J
See the example for more information.

Example

The following example stores the tab character (a decimal 9 in ASCII) in a character, then uses that character as a delimiter.

  myTabChar CHAR(1) = strLib.intAsChar(9);
  sqlLib.loadTable("myDataFile.txt", "INSERT INTO myTable", myTabChar);    

Compatibility

Table 1. Compatibility considerations for sqlLib.loadTable()
Platform Issue
COBOL generation The function is not supported.

Feedback