Trap Oracle error in shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trap Oracle error in shell script
# 1  
Old 07-23-2013
Trap Oracle error in shell script

Code:
 
sqlplus -s usrname/password@dbSID <<-SQL >> logfile
@create_table.sql
commit;
quit;
SQL

I am running this script to execute an sql file.
I want to display the oracle error if anything found during execution of the sql file and exit from script.

Please suggest How do it.
# 2  
Old 07-23-2013
u can make use of WHENEVER SQLERROR feature of Oracle in your .sql to return the oracle error code and pass it to oerr ora <<error number>> to display the error description.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to find the wrong filename in a path and raise a trap for it

Example: I have server name A with an IP : 125.252.235.455 I have an username /password to login into this server under SSH connection In this server i have a path /apps/user/filename(Big.txt) Everyday we used to get the filename as Big.txt. I want a shell script to monitor this path... (4 Replies)
Discussion started by: ChandruBala73
4 Replies

2. Shell Programming and Scripting

Shell script to set trap for finding cron job failures

Unix box: solaris 5.8 Server: IP Need to to set trap for cron job failures by writing a shell script (5 Replies)
Discussion started by: ChandruBala73
5 Replies

3. Shell Programming and Scripting

How to pass Oracle sql script as argument to UNIX shell script?

Hi all, $ echo $SHELL /bin/bash Requirement - How to pass oracle sql script as argument to unix shell script? $ ./output.sh users.sql Below are the shell scripts and the oracle sql file in the same folder. Shell Script $ cat output.sh #!/bin/bash .... (7 Replies)
Discussion started by: a1_win
7 Replies

4. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

5. Red Hat

KSH script help needed ( nice error trap routine ?)

I am running a script that runs a loop and executes a command on ${i} until the end of the for loop. From time to time the command generates an error ( which is good) for example ERROR0005: How can I trap the error and send an email echoing the ${i} variable in the loop and the error ? ... (2 Replies)
Discussion started by: pcpinkerton
2 Replies

6. Shell Programming and Scripting

How trap a signal in shell script?

Hi , i have a scenario where...i have to put a check where if script is executing more than 15mins i have to kill that script and n retry again 2nd time. i this case i can use background process to do it but i feel trap will be the efficent way to do so... but i dont know much about it... (1 Reply)
Discussion started by: crackthehit007
1 Replies

7. Shell Programming and Scripting

Want to trap script error and return line number of failure

Hey all UNIX nerds- I've built a shell script which runs pretty well- only I want it to have much better error trapping. (Like the kind I could apply to every shell script I write). I'm not a UNIX genius, and could really use a bit of help. The original script goes something like this: 1... (3 Replies)
Discussion started by: stevekerver
3 Replies

8. UNIX for Advanced & Expert Users

trap ctrl c in shell script

how to trap the ctrl c in unix shell script my script is running in while loop it should not be terminate with ctrl c. if i press ctrl c while running script it shloud ignore the same. please healp.......... thanks in advance (2 Replies)
Discussion started by: arvindng
2 Replies

9. UNIX for Advanced & Expert Users

how to use trap command in shell script

Right now I have implemented autossh between ServerA & ServerB which are sun solaris based. I have made this shell script. I am facing one problem which I am going to discuss now. The problem is when I sftp some files (suppose there is 10 files I have to transfer through sftp) from one server to... (2 Replies)
Discussion started by: girish.batra
2 Replies

10. UNIX for Advanced & Expert Users

Shell script on Oracle hot backup got an error

Hi Unix Shell Script Expert, We have a robust shell script (from old time) for our 9i database hot backup but generated error: Shell Script Content: #check for auto log mode and redirect as early as possible # autolog_enable $AUTOLOG_MODE $ORACLE_BASE/${ORASID_LOW}log/cron_hotbackup.log... (1 Reply)
Discussion started by: oradbus
1 Replies
Login or Register to Ask a Question