Solved

Trap Sql-Loader Error inside perl script

Posted on 2012-04-11
3
695 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
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 34

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bash Script to Analyze Oracle Schemas 11 102
Get the parent node - XMLTYPE 9 70
SQL query question 8 73
migration MS SQL database to Oracle 30 59
How to Unravel a Tricky Query Introduction If you browse through the Oracle zones or any of the other database-related zones you'll come across some complicated solutions and sometimes you'll just have to wonder how anyone came up with them.  …
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

786 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