Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLLDR: (CTL file) How to ONLY load 1 record of the CSV file

odabovalJan 22 2010 — edited Jan 22 2010
Hello,

We are in 11g, and we get CSV data.

I'd like to know if there is a way in the CTL file to specify that I only want to load first row ?
I know how to do it if there is a common unique value in the first row (WHEN myColumn = 'value1' )

BUT, in that case, first row doesn't hold any specific value, and I think that I have to tell the loader to take only first row.

I hope it is clear.

Here is the CTL, in the case we can get a specific value for first row:
LOAD DATA
CHARACTERSET WE8ISO8859P1
APPEND
CONTINUEIF LAST != ";"
INTO TABLE IMPORT_FIRST_LINES
WHEN COL_3 = 'firstRowValue'
   FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
( COL_1         CHAR
, COL_2         CHAR
, COL_3         CHAR)
{code}

So, I think I need to change the *WHEN clause*.

I hope it is clear enough for you to understand.
Thanks in advance,
    Olivier                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2010
Added on Jan 22 2010
5 comments
3,968 views