Solved

Trap Sql-Loader Error inside perl script

Posted on 2012-04-11
3
699 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 250 total points
ID: 37833000
>>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 35

Accepted Solution

by:
johnsone earned 250 total points
ID: 37833202
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
ID: 37833403
ok many thanks to both of you...
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Repeat query 13 74
Database Design Dilemma 6 65
update statement in oracle 9 40
Oracle 11gR2 Middleware: multiple domains with individual admin servers? 4 23
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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.

733 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