Hi to all.
I have to launch a shell unix (in a batch) who executes a .sql.
Sql file executes a stored procedure Oracle.
My problem is to return an error message in the batch if anythings goes wrong in the sql ( proc invalid, tables not founded...).
Thanks,
M.
Reporting error in Batch of a Shell Unix executing sql
Moderators: chulett, rschirm, roy
You'll need to set the exit status of the script appropriately based on what happens inside your sqlplus session. And that will also depend on how your proc reports out problems. We do this by echoing all activity during the session into a tmp file and then grep'ing the file for Oracle errors. If any are found, set the exit status appropriately and the calling job will notice.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
ray.wurlod
- Participant
- Posts: 54595
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Welcome aboard. :D
You manage this by including appropriate logic and exit commands in your script. For example exit 0 on success, exit 1 on failure. You can even return specific codes from shell variables, for example exit $reasoncode
You manage this by including appropriate logic and exit commands in your script. For example exit 0 on success, exit 1 on failure. You can even return specific codes from shell variables, for example exit $reasoncode
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
