Re: Tracking Return Codes from script execution

From: Marek Wiechula and Sheila Plant <sparemgw_at_batelco.com.bh>
Date: 1996/11/01
Message-ID: <327A442A.159C_at_batelco.com.bh>#1/1


Govindhan Padmavijayam wrote:
>
> I would like to know if there's a way to check for return codes from a
> Function execution.
>
> I would like to populate values into a table, by passing
> parameters thro' a function. If, for example, the insert fails (
> owning to a Primary Key constraint ), how would I be able to track
> the sqlcode 0001 from, say, a shell program ? Can this tracked
> thro' the $? in Unix ? The problem I have is that if the Primary Key
> constraint error is encountered, control does not pass back to the
> code. Is there a way to get around this problem.
>

It would be possible but admittedly quite clunky, to set up a UNIX script that would process each such insert in turn. Instead of using the UNIX return codes to return the values use the output of the script. It can either be a value printed to standard out, which could then be captured into a shell variable as in...

RETURN_CODE=`myscript parm1 parm2 ... parmn`

or it could simply communicate through a know temporary file name.

This could return any of a wide variety of error codes including an all clear. If you put enough of your error code processing into this script you could generate an exception list directly to a separate disk file from here.

The processing inside the script would use a sqlplus invocation that wrote its output directly to another UNIX file, which you could then examine with an awk script or something to pick out error codes.

Clunky but it might do what you want....

Marek Received on Fri Nov 01 1996 - 00:00:00 CET

Original text of this message