The SYSCS_UTIL.SYSCS_EXPORT_QUERY system procedure exports the results of a SELECT statement to an operating system file in a delimited data file format.
SYSCS_UTIL.SYSCS_EXPORT_QUERY(IN SELECTSTATEMENT VARCHAR(32672), IN FILENAME VARCHAR(32672), IN COLUMNDELIMITER CHAR(1), IN CHARACTERDELIMITER CHAR(1), IN CODESET VARCHAR(128))
No result is returned from the procedure.
- An input argument of type VARCHAR(32672) that specifies the select statement (query) that will return the data to be exported. Passing a NULL value will result in an error.
- An input argument of type VARCHAR(32672) that specifies the name of the file to which data is to be exported. If the complete path to the file is not specified, the export procedure uses the current directory and the default drive as the destination. If the name of a file that already exists is specified, the export procedure overwrites the contents of the file; it does not append the information. Passing a null will result in an error.
- An input argument of type CHAR(1) that specifies a column delimiter. The specified character is used in place of a comma to signal the end of a column. Passing a NULL value will use the default value; the default value is a comma (,).
- An input argument of type CHAR(1) that specifies a character delimiter. The specified character is used in place of double quotation marks to enclose a character string. Passing a NULL value will use the default value; the default value is a double quotation mark (").
- An input argument of type VARCHAR(128) that specifies the code set of the data in the exported file. The name of the code set should be one of the Java-supported character encodings. Data is converted from the database code set to the specified code set before writing to the file. Passing a NULL value will write the data in the same code set as the JVM in which it is being executed.
The following example shows how to export the information about employees in Department 20 from the STAFF table in the SAMPLE database to the myfile.del file.
CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY('select * from staff where dept =20', 'c:/output/awards.del', null, null, null);
For more information on exporting, see the Derby Tools and Utilities Guide.
Table of Contents