Consider loading a delimited ASCII text file into a table with the following schema:
TABLE employee ( name CHAR(18) NOT NULL, hiredate DATE DEFAULT TODAY, address VARCHAR(40), empno INTEGER);
The SQL statements to load into this table would be as follows:
CREATE EXTERNAL TABLE emp_ext SAMEAS employee USING ( DATAFILES ("DISK:1:/work2/mydir/emp.dat"), REJECTFILE "/work2/mydir/emp.%c.rej" ); INSERT INTO employee SELECT * FROM emp_ext;
The external table has the same name, type, default, and check constraint for each column because the CREATE statement includes the SAMEAS keyword. The default format is delimited, so no format keyword is required.
Delimited files are ASCII by default. For EBCDIC files, specify CODESET EBCDIC in the USING clause. The default row delimiter is an end-of-line character unless you use the RECORDEND keyword to specify a different delimiter when you created the external table. (The RECORDEND keyword works for delimited format only.)
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]