Reporting error in Batch of a Shell Unix executing sql

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
m.amari
Participant
Posts: 1
Joined: Fri Dec 02, 2005 7:18 am

Reporting error in Batch of a Shell Unix executing sql

Post by m.amari »

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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

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
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply