Thanks paquicuba
Main Topics
Browse All TopicsHi Experts,
I have couple questions regarding requirement which I am working right now. Currently, we have a requirement of loading large number of records into Oracle tables. So we figured out of using SQL Loader for that purpose. So my questions for this requirement are here.
1. Can I Call SQL Loader in a Stored Procedure if Yes how?
2. How is the Error handling done in SQL Loader, like can i store the no of error records into a Oracle table, so that i can log the no of errors in a particular data load.
Can Anybody help on this. I would like to see some code examples on error handling.
Thanks In Advance
Chirag Patel
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: paquicubaPosted on 2009-01-13 at 07:28:04ID: 23363644
You can use External tables...
Let's say that you have a text file located in a specific directory, all you need to do is create an interface for that file using the external table construct.
e.g. --> C:/Vendors.txt
To create an interface for the above file, you frst need to create a directory for C:\, which I'm naming CDIR, then your external table as below:
CREATE TABLE VENDORS( VARCHAR2(15), VARCHAR2(30), ODE VARCHAR2(5), ILE LE
VENDOR_NAME VARCHAR2(100),
TAXPAYER_ID VARCHAR2(15),
VENDOR_NUMBER
IRS_ORIG_TYPE
VENDOR_ADDR1 VARCHAR2(50),
VENDOR_ADDR2 VARCHAR2(50),
VENDOR_ADDR3 VARCHAR2(50),
VENDOR_CITY VARCHAR2(20),
VENDOR_STATE VARCHAR2(5),
VENDOR_ZIP VARCHAR2(15),
VENDOR_AREA_C
VENDOR_PHONE VARCHAR2(10)
)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY CDIR
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE
NOBADFILE
NODISCARDF
NOLOGFI
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
)
LOCATION ('VENDORS.TXT'))
REJECT LIMIT UNLIMITED;
Additionally, you can also specify where you want BADFILEs, DISCARDFILEs & LOGFILEs to go (the above table is not logging anything)
Once you have your external table, you can select from it as it's a normal table and call it from within a procedure as well where you can load your big table and handle exceptions...