4

Currently my control file is as :

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)"
)

Current input file :

Emp_id,emp_name,sal
1,A,100
2,B,200

I now have another requirement where the input files wil contain 2 headers and will be like

/folder1/folder2/file1_<date>.csv
Emp_id,emp_name,sal
1,A, 100
2,B,200
...

Similarly I will have multiple input files ...

Can you please help me with the control file for this scenario ?

Nemus
  • 3,879
  • 12
  • 38
  • 57
user6157109
  • 63
  • 1
  • 1
  • 5

1 Answers1

8

You need the SKIP=2 OPTIONS clause.

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)"
)

See here for more info: https://docs.oracle.com/cd/B28359_01/server.111/b28319/ldr_control_file.htm#i1004816

Gary_W
  • 9,933
  • 1
  • 22
  • 40