The sqlLib.unloadTable() system function unloads data from a relational database into a file. The function is available only for Java™ generation.
To load information from a file and insert it into a relational database table, use the sqlLib.loadTable() function.
sqlLib.unloadTable(
fileName STRING in,
selectStatement STRING in
[, delimiter STRING in
])
"SELECT column1, column2 FROM myTABLE
WHERE column3 > 10"
The default symbol for delimiter is the value in the Java vgj.default.databaseDelimiter 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",
"SELECT column1, column2 FROM 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. |