Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oracle loader help

Posted on 2015-01-27
3
Medium Priority
?
204 Views
Last Modified: 2015-02-08
Hi ,

I am using sqlloader to load the below file to the table.

The file content is : 1.txt

Started
FirstName,LastName
Craig,G
Simon,R
Finished

I want to skip the header and trailer, for header i can use OPTIONS SKIP line 1 but dont know how to skip
line1,2, and lastline in the file.

My AIM is to load only lines separated by comma.
      
Thanks
0
Comment
Question by:magento
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
Naveen Kumar earned 2000 total points
ID: 40574569
OPTIONS(SKIP = 2 ) --> this can be used to skip lines in the header.

For trailers, we can use a condition to skip as shown below. Give it a try to test :

OPTIONS ( SKIP = 2)
LOAD DATA
INFILE 'Ash.CSV' ----> change here accordingly
TRUNCATE
INTO TABLE mytable --> change table name
WHEN (1:8) <> 'Finished'
FIELDS TERMINATED BY ',' Optionally enclosed by '"'
TRAILING NULLCOLS
(
 ...
)

Thanks
0
 
LVL 5

Author Closing Comment

by:magento
ID: 40597766
Thanks
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 40597797
Good and Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to recover a database from a user managed backup
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question