I have this exercise: having this type of text file
10012020/07/057
10022020/07/055
10032020/07/100
10042020/07/079
10052020/07/103
10062020/07/098
10072020/07/104
10082020/07/101
10092020/07/104
10102020/07/063
Insert the records in an external table (like the one below) using the number of characters as delimiter.
CREATE TABLE Ftest (
idF VARCHAR(255),
dt DATE,
n VARCHAR(255)
)
ORGANIZATION EXTERNAL
(
TYPE oracle_loader
DEFAULT DIRECTORY desktop
ACCESS PARAMETERS
(
RECORDS DELIMITED BY '\n'
BADFILE CHARACTER
DISCARDFILE CHARACTER
LOGFILE CHARACTER
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY "'"
MISSING FIELD VALUES ARE NULL
(
idF CHAR(255),
dt CHAR(255) date_format DATE mask 'YYYY/MM/DD',
numero CHAR(255)
)
)
LOCATION ('Test.csv')
)
REJECT LIMIT UNLIMITED;
Taking the first record, I have: 10012020/07/057 so
- Field 1 (idF) = 1001 [4 characters]
- Field 2 (dt)= 2020/07/05 [10 characters]
- Field 3 (n)= 7 [1 characters]
I have no idea what sql commands to use to specify the delimiter for each field. Do you have any suggestions? Or a solution to modify the file before it is inserted in the table, but always in sql language?