Error checking
Bart Pietercil
bart.pietercil at gmail.com
Fri Sep 21 03:19:53 CDT 2007
Hi List,
This stored procedure works:
create or replace procedure spBuildUserTypes()
begin
DECLARE mylastrecid Long;
insert into tbl_typelists(created_by,typelistname) values
('spBuildUserTypes','usertypes');
set mylastrecid = select recid FROM tbl_typelists where typelistname
= 'usertypes';
insert into tbl_typelistvalues
(displayname,listvalue,objptr_typelist) values ('active',1,mylastrecid);
insert into tbl_typelistvalues
(displayname,listvalue,objptr_typelist) values ('deactivated',
2,mylastrecid);
insert into tbl_typelistvalues
(displayname,listvalue,objptr_typelist) values ('blocked',
3,mylastrecid);
exception
when 50000 then
print 'dummy';
when others then
print 'something went wrong';
end
when called it gives in the console:
Number of affected rows: 4, query time: 0.123 sec
Perfect! Feeling great love for Valentina at this point :-)
Now the tbl_typelists has as you can see a field typelistname. This
is defined to be unique
So when I call spBuildUserTypes again I expect to see 'something went
wrong' in the console .Unique_key_violation should trigger the
exception I believe.
But the console prints "call spBuildUserTypes()" has been executed"
When verifying the data nothing has changed (I still have 1 list with
3 items in it). So that is correct.
So I guess the questions is why was the exception part of the
procedure not executed ?
This is also the point that I remember Valentina is a women's name,
so besides love I also need a bigger portion of understanding...;-)
TIA
Bart Pietercil
More information about the Valentina
mailing list