Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How do I retrieve an error status during sqlplus execution???

Re: How do I retrieve an error status during sqlplus execution???

From: Jason Judge <jason.judge_at_virgin.net>
Date: Wed, 23 Jun 1999 23:40:15 +0100
Message-ID: <7krngk$26e$1@nclient3-gui.server.virgin.net>


Catching the output to a log file then scanning it for errors (or some string with a status code that I have printed) has certainly been the most successful method in my experience.

I would also avoid putting the password on the sqlplus command line since under Unix this will be visible in the process list and could be picked up by anyone. Instead use the 'connect' command within your script, e.g.

sqlplus -s <<-ENDSQL >logfile

    connect username/password
    select sysdate
    from dual;
ENDSQL There is another command switch (or option) that sqlplus takes to allow it to run without prompting for a username or password. I think it is 'nolog=yes' or '-n' - check the documentation.

Regards,

Jason Judge

Laura González wrote in message <3770DAAC.B23D71F8_at_stl.es>...
>Hi, again a newbie in this world. Thanks for your last help about
>feedback.
>
>Now my problem is this:
>
>I have several shell scripts with calls to sqlplus, similar to:
>
>
> echo "beginning"
> sqlplus user/pass << END
> update ....
> commit;
> exception
> when others then
> dbms_output.put_line ('You are in trouble')
> END
>
> echo "this is the end and it finished with status ..."
>
>Sometimes, it happens that a rollback segment is full, so I can see the
>message 'You are in trouble', I like it, BUT, and that is my problem, I
>don't know how could I retrieve an error status inside the shell script
>coming from the sqlplus.
>Now, if I ask for the status immediatly after de 'end' of may sqlplus, I
>always obtain OK, even in the case of the full rollback segment - I
>supose this is because sqlplus is ok, the problem was inside it -.
>
>Well, I hope I have explained my problem ... and Thanks for your help.
>
>
>
>
>--
>***************************************************************************
**
>
>Laura González
> Tlfno : 91.348.92.35
>Dept. Sistemas de Información Fax : 91.348.91.13
>Sistemas Técnicos de Loterías e-mail:
>l_gonzalez_at_stl.es
>
>***************************************************************************
** Received on Wed Jun 23 1999 - 17:40:15 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US