Solved

Trap Sql-Loader Error inside perl script

Posted on 2012-04-11
3
692 Views
Last Modified: 2012-04-11
HI,

I have a problem. I want to catch the return code from SQL Loader inside perl script. How can I do it?

I am doing the following. Here SQL Loader returns 0, even if it is successful to insert all rows which is correct but it also returns 0 if the column name is changed and as a result no rows are getting inserted which I am assuming is wrong. What is the problem here? Is this the right way to trap SQL-LDR errors?

A.pl
---------------------------------------------------------


`ksh file1.ksh`;


print "\nThe sqlldr return code is $?\n";

if (($? == 0) or  ($? ==2))

{

print \nError in Loading\n";
exit 1;
}

else { print "\nData Loaded in DB in Table1\n";
}


---------------------------------------------------------------------

Here is my file1.ksh --->


file1.ksh
-----------------------------------------------------------------

sqlldr id/pwd@server control=Table1.ctl log=Table1.log
--------------------------------------------------------------
0
Comment
Question by:sunny82
3 Comments
 
LVL 76

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 250 total points
Comment Utility
>>Is this the right way to trap SQL-LDR errors?

I believe sqlloader is always successful.  I mean that it always executes.

You will likely need to parse the log file to see if it actaully loaded everytihng it was supposed to.
0
 
LVL 34

Accepted Solution

by:
johnsone earned 250 total points
Comment Utility
SQL*Loader does have a return code to tell you whether a load is successful or not.  They are detailed here:

http://docs.oracle.com/cd/E11882_01/server.112/e22490/ldr_params.htm#i1005019

If you want to get more information than the return codes give you, you would have to parse the log file.
0
 

Author Comment

by:sunny82
Comment Utility
ok many thanks to both of you...
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now