I am uploading the data with SQL Loader, in the file.txt file I have 3 fields and I want to load the field UPLOAD_DATE with sysdate and FILE_NAME with 'archivo.txt'
I tried to do something like this with SQL Loader, for example:
UPLOAD_DATE DATE TERMINATED BY "|" sysdate,
FILE_NAME CHAR(200) TERMINATED BY "|" "archivo.txt"
but this does not work, there is another way to load this information
Error
SQL*Loader-350: Syntax error at line 14.
Expecting "," or ")", found keyword sysdate.
UPLOAD_DATE DATE TERMINATED BY "|" SYSDATE,
ControlFile.ctl
OPTIONS (SILENT=(ALL, HEADER))
load data
infile file.txt
badfile file.bad
discardfile file.dis
append
into table TABLE_INFO
fields terminated by '|'
TRAILING NULLCOLS (
SUB_ID INTEGER EXTERNAL TERMINATED BY "|",
SUB_PROPERTY CHAR(4000) TERMINATED BY "|",
MODIFY_TIME DATE TERMINATED BY "|" "to_date(:MODIFY_TIME, 'MM/DD/YYYY HH:MI:SS PM')",
UPLOAD_DATE DATE TERMINATED BY "|" "to_date(:UPLOAD_DATE, 'MM/DD/YYYY HH:MI:SS PM')",
FILE_NAME CHAR(200) TERMINATED BY "|"
)
Table
create table TABLE_INFO
(
sub_id NUMBER(20) not null,
sub_property VARCHAR2(4000),
modify_time DATE,
upload_date DATE,
file_name VARCHAR2(200)
)
file.txt
11|campo2|09/13/2017 11:36:11 PM
12|campo1|09/22/2017 02:41:38 PM
sqlldr userbd/passbd control=ControlFile.ctl log=log_file.log rows=10000 direct=true
terminated byclause to do when you're supplying a value from the control file - when there is no field in the data file to be terminated? And is there a reason you're specifying it again for each field anyway, when you've set it as the defaultfieldssetting?