Cool, thanks
A reader, November 09, 2001 - 5:30 pm UTC
Great!
Alan Rech, November 12, 2001 - 6:31 am UTC
Thanks Tom!!!
The answer to the fisrt question is exactly what I need...
But in the second, it'll not work when you have a script that mixes PL/SQL with SQL*Plus commands...
Best regards,
Alan
November 12, 2001 - 9:38 am UTC
what I do then is something like:
set serveroutput on
set feedback off
spool temp.sql
begin
if ( something )
then
dbms_output.put_line( 'host ..... ' );
else
dbms_output.put_line( 'prompt nothing to do here, skipping host' );
end if;
end;
/
spool off
@temp
Re: Follow-up
Alan Rech, November 12, 2001 - 11:38 am UTC
This is a good alternative! I'll try it...
Thanks again.
[]'s
Alan
Equivalent in PL/SQL
VA, July 16, 2005 - 9:32 pm UTC
How can I get the equivalent of "whenever sqlerror continue" in a PL/SQL stored procedure?
I have a SQL "script" that I am trying to convert to a PL/SQL stored procedure. It does lots of create table, drop tables, add column, drop column, etc.
It could be aborted by the user at any time, so its state is not really known. So, when it is restarted, it might try to drop a table that doesnt exist, create one that exists, etc.
Short of wrapping each DDL statement in a 'when others then null', how can I just ignore such errors like 'whenever sqlerror continue'?
Thanks
July 17, 2005 - 8:55 am UTC
well, that could be quite dangerous couldn't it.
but in short, very very much fortunately, there is not any "please just ignore errors, go ahead and do the damage" mode in the programming language that is plsql.
You would have to wrap statements you anticipate failing with exception blocks.
Jagadeesh Tata, July 18, 2005 - 6:03 am UTC
Good...
How to exit from if...
A reader, September 11, 2007 - 8:29 am UTC
Tom,
I try to write a script with anonymous plsql block that check database version and if the database version > 8 it does some selects against v$views that exist only in >8 db otherwise exit with a message "Option is not available in this database version".
The problem is if I write
if ... then ... else and place my select statement for 9i/10G database in the else...Oracle brings object not exist error.
What I want is to see only the output "Option not available" and not the error text (if I set whenever sqlerror exit) in case of 8 db and go to my select statements in case of 9i/10g
September 15, 2007 - 3:24 pm UTC
use dynamic sql of course.
if (version >8)
then
open cursor c for 'select * from v$whatever';
loop
fetch c into .....;
exit when c%notfound;
.....
end loop;
close c;
else
dbms_output.put_line( 'you lose' );
end if;
Thank you.
A reader, February 12, 2015 - 2:20 am UTC
Thanks for having this up. Just wanted to let you know that it is still of use.
Still useful :)
A reader, April 03, 2022 - 5:47 pm UTC