Adding an End-of-Line Character to a Fixed Text File
You can add an end-of-line character to each line of a fixed-text file to use the file for other applications.
If you are writing text in a fixed-text format, separate
lines for each record are helpful. An end-of-line character makes
the date more legible and clear. If you use delimited format defaults,
an end-of-line character is automatic. However, for fixed-format unloads,
you need to add an end-of-line character to your records. For example,
consider a table with the following schema:
TABLE sample (
lastname CHAR(10),
firstname CHAR(10),
dateofbirth DATE);
This table contains the following
values:
Adams Sam 10-02-1957
Smith John 01-01-1920
Next,
consider an external table with the following schema:
CREATE EXTERNAL TABLE sample_ext (
lastname CHAR(10) EXTERNAL CHAR(10),
firstname CHAR(10) EXTERNAL CHAR(10),
dateofbirth DATE EXTERNAL CHAR(12));
Unloading sample_ext without
an end-of-line character produces the following output:
Adams Sam 10-02-1957 Smith John 01-01-1920
You can add end-of-line characters by using a program or script, or by adding a newline field in a SELECT statement.