目前我的控制文件为:
Load data
Infile '/.../../emp*.txt'
Append into table emp_load
When (emp_id <> 'emp_id')
Fields terminated by "," optionally enclosed by ' " '
Trailing nullcols
(Emp_id "TRIM(:EMP_ID)",
EMP_NAME "TRIM(:EMP_NAME)",
SAL "TRIM(:SAL)"
)
当前输入文件:
Emp_id,emp_name,sal
1,A,100
2,B,200
我现在有另一个要求,即输入文件将包含2个标题,并且类似于
/folder1/folder2/file1_<date>.csv
Emp_id,emp_name,sal
1,A, 100
2,B,200
...
同样我会有多个输入文件...
你能帮我解决这个场景的控制文件吗?
答案 0 :(得分:0)
您需要SKIP = 2 OPTIONS子句。
OPTIONS (SKIP=2)
Load data
Infile '/.../../emp*.txt'
Append into table emp_load
When (emp_id <> 'emp_id')
Fields terminated by "," optionally enclosed by ' " '
Trailing nullcols
(Emp_id "TRIM(:EMP_ID)",
EMP_NAME "TRIM(:EMP_NAME)",
SAL "TRIM(:SAL)"
)
有关详细信息,请参阅此处:https://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_control_file.htm#i1004816