Version: 11.2.0.2
I always come across SQL scripts with WHENEVER SQLERROR .... Isnt this feauture useless when there are DDLs in the script ?
sample sql script
set echo on
set feedback on
WHENEVER SQLERROR EXIT FAILURE
spool mylog.txt
create table testertab1 (ename varchar2(5));
create table testertab2 as select * from all_objects;
insert into testertab1 values ('PEDRO');
insert into testertab1 values ('JONATHAN');
commit;
spool off
The second INSERT will error out, but both of the above 2 CREATE TABLE DDLs cannot be rolled back ; so there is no point in having WHENEVER SQLERROR.. . Right ?
But I have come across lot of SQL scripts with CTAS which has WHENEVER SQLERROR EXIT FAILURE. Maybe the developers don't understand the use of this SQL*Plus feauture correctly.
Any idea why P.Forstman is using WHENEVER SQLERROR EXIT FAILURE in his example in the below thread ?
921719