begin declare continue handler for sqlstate '42704' begin /* Ignore */ end@

begin declare continue handler for sqlstate '42704' begin /* Ignore */ end@

Post by Serge Riel » Wed, 29 Jul 2009 07:04:46



Semicolons are used within SQL PL to delimit statements.

Also I don't think you can do a straight alter table within a compound.
You need to go through dynamic SQL.
In DB2 9.7 you should be able to use the string directly:
EXECUTE IMMEDIATE ' ...';

begin
declare txt VARCHAR(1000) DEFAULT
'alter table can drop constraint can_fk2';
declare continue handler for sqlstate '42704'
begin /* Ignore */ end;
EXECUTE IMMEDIATE txt;
end@

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab