Is there a way to rollback and exit a psql script on error?

Posted by metanaito on Stack Overflow See other posts from Stack Overflow or by metanaito
Published on 2010-04-23T18:46:29Z Indexed on 2010/04/23 19:03 UTC
Read the original article Hit count: 268

Filed under:
|

I have a psql script that looks like this:

-- first set of statements
begin
sql statement;
sql statement;
sql statement;
exception
    when others then
    rollback
    write some output
    (here I want to exit the entire script and not continue on to the next set of statements)
end
/
-- another set of statements
begin
sql statement;
sql statement;
sql statement;
exception
    when others then
    rollback
    write some output
    (here I want to exit the entire script and not continue)
end
/
... and so on

Is it possible to exit the script and stop processing the rest of the script?

© Stack Overflow or respective owner

Related posts about Oracle

Related posts about psql