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.
sqlLib.loadTable(
fileName STRING in,
insertIntoClause STRING in
[, delimiter STRING in
])
"INSERT INTO myTable(column1, column2)"
"INSERT INTO myTable"
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 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);
In the files accessed by the sqlLib.loadTable() or sqlLib.unloadTable() function, a zero-length string is represented by the "\" character followed by a blank, and a null is represented by two delimiters in a row.
||\ | |1234
That string contains a null, a zero-length string, a string of one blank, and "1234".
| Platform | Issue |
|---|---|
| COBOL generation | The function is not supported. |