- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Unable to trap the correct $? from SQL* Loader
Operating System - HP-UX
1819870
Members
2545
Online
109607
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-26-2004 08:55 AM
тАО04-26-2004 08:55 AM
All,
I am trying to trap the exit status after executing sql*loader.
Although the script fails and writes the failure message in the log file. The exit status '$?' comes out to 0.
Is there anyway I can trap the correct exit status so I may know whether sql*loader has executed successfully or not? I don't want to go the log file and grep for error.
Thank You,
Suman
I am trying to trap the exit status after executing sql*loader.
Although the script fails and writes the failure message in the log file. The exit status '$?' comes out to 0.
Is there anyway I can trap the correct exit status so I may know whether sql*loader has executed successfully or not? I don't want to go the log file and grep for error.
Thank You,
Suman
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-26-2004 01:46 PM
тАО04-26-2004 01:46 PM
Re: Unable to trap the correct $? from SQL* Loader
Hi
The script itself can generate a failure message and becouse it has done its programmed task (even though it has generated an error) can exit with a 0 (zero) error and be correct.
Paula
The script itself can generate a failure message and becouse it has done its programmed task (even though it has generated an error) can exit with a 0 (zero) error and be correct.
Paula
If you can spell SysAdmin then you is one - anon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-26-2004 04:17 PM
тАО04-26-2004 04:17 PM
Solution
Hi Suman,
The return code of sql*loader will return zero as it has completed its task and exited. If there are error while loading the data then the log file will tell you the error detals as to how many records loaded and how many records rejected. And there will be a bad file in the directory with the rejected data records.
So it is not possible to get the return code of an sql*loader to find it there are errors or not. The bestway will be to check the log file.
Oherwise if you need to know if there are error without checking the log file you can check for an existence of a bad file with extension (.bad) in the directory and this will tell you that there was an error while loading. This can be done by the script automatically. Check for existence of bad file and echo error or send auto e-mail.
I hope this helps.
Indira A
The return code of sql*loader will return zero as it has completed its task and exited. If there are error while loading the data then the log file will tell you the error detals as to how many records loaded and how many records rejected. And there will be a bad file in the directory with the rejected data records.
So it is not possible to get the return code of an sql*loader to find it there are errors or not. The bestway will be to check the log file.
Oherwise if you need to know if there are error without checking the log file you can check for an existence of a bad file with extension (.bad) in the directory and this will tell you that there was an error while loading. This can be done by the script automatically. Check for existence of bad file and echo error or send auto e-mail.
I hope this helps.
Indira A
Never give up, Keep Trying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-26-2004 11:06 PM
тАО04-26-2004 11:06 PM
Re: Unable to trap the correct $? from SQL* Loader
Hello,
Check your OracleX Database Utilities documentation :
Exit Codes for SQL*Loader
All rows loaded successfully EX_SUCC
All or some rows rejected EX_WARN
All or some rows discarded EX_WARN
Discontinued load EX_WARN
Command-line or syntax errors EX_FAIL
Oracle errors nonrecoverable for SQL*Loader EX_FAIL
Operating system errors (such as file open/close and malloc) EX_FAIL
For UNIX, the exit codes are as follows:
EX_SUCC 0
EX_FAIL 1
EX_WARN 2
EX_FTL 3
Oracle offers a script to test the return code :
#!/bin/sh
sqlldr scott/tiger control=ulcase1.ctl log=ulcase1.log
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
But, I'm with Indira on this, it's best to check the log and look for specific errors. Espacially if you exepect normal discard, head / footer ...
Cheers
Nicolas
Check your OracleX Database Utilities documentation :
Exit Codes for SQL*Loader
All rows loaded successfully EX_SUCC
All or some rows rejected EX_WARN
All or some rows discarded EX_WARN
Discontinued load EX_WARN
Command-line or syntax errors EX_FAIL
Oracle errors nonrecoverable for SQL*Loader EX_FAIL
Operating system errors (such as file open/close and malloc) EX_FAIL
For UNIX, the exit codes are as follows:
EX_SUCC 0
EX_FAIL 1
EX_WARN 2
EX_FTL 3
Oracle offers a script to test the return code :
#!/bin/sh
sqlldr scott/tiger control=ulcase1.ctl log=ulcase1.log
retcode=`echo $?`
case "$retcode" in
0) echo "SQL*Loader execution successful" ;;
1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
3) echo "SQL*Loader execution encountered a fatal error" ;;
*) echo "unknown return code";;
esac
But, I'm with Indira on this, it's best to check the log and look for specific errors. Espacially if you exepect normal discard, head / footer ...
Cheers
Nicolas
All different, all Unix
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP