FAQ
Hi!

I have a SQL*Plus script that rolls back whenever an error occurs:

... whenever sqlerror exit SQL.SQLCODE ROLLBACK

Is there a way to get an exit code AND roll back when an error occurs?

I know that "... whenever sqlerror exit 99" exits with an error code but it
does not roll back that transaction, i.e. if some insert statements were
already sucessful then they are not rolled back.

Is there any way to exit with an error code and roll back the transaction?

This is 9.2 on HP-UX.

Thanks,
Helmut

Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org
put 'unsubscribe' in the subject line.

Search Discussions

  • Sfaroult_at_oriole.com at Mar 23, 2004 at 4:33 am
    Helmut,

    It may not be supremely elegant but you can keep

    whenever sqlerror exit sql.sqlcode

    at the beginning, and put everything else into a

    begin

    do your stuff here
    exception
    when others then
    rollback;
    raise;
    end;

    block.

    HTH,

    S Faroult
    Hi!

    I have a SQL*Plus script that rolls back whenever an error occurs:

    .... whenever sqlerror exit SQL.SQLCODE ROLLBACK

    Is there a way to get an exit code AND roll back when an error occurs?

    I know that "... whenever sqlerror exit 99" exits with an error code but it
    does not roll back that transaction, i.e. if some insert statements were
    already sucessful then they are not rolled back.

    Is there any way to exit with an error code and roll back the transaction?

    This is 9.2 on HP-UX.

    Thanks,
    Helmut
    ----------------------------------------------------------------
    Please see the official ORACLE-L FAQ: http://www.orafaq.com
    ----------------------------------------------------------------
    To unsubscribe send email to: oracle-l-request_at_freelists.org
    put 'unsubscribe' in the subject line.
    --
    Archives are at http://www.freelists.org/archives/oracle-l/
    FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
    -----------------------------------------------------------------
    Oracle scripts, papers and DBA Tools --
    Oriole Corporation --
    http://www.oriole.com/ --

    Please see the official ORACLE-L FAQ: http://www.orafaq.com

    To unsubscribe send email to: oracle-l-request_at_freelists.org
    put 'unsubscribe' in the subject line.

    --
    Archives are at http://www.freelists.org/archives/oracle-l/
    FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html
    -----------------------------------------------------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouporacle-l @
categoriesoracle
postedMar 23, '04 at 4:17a
activeMar 23, '04 at 4:33a
posts2
users2
websiteoracle.com

People

Translate

site design / logo © 2022 Grokbase