If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Capture error description in SP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-05, 06:56
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
Capture error description in SP

hi

db2 8.2 in win.

I have this sp:
-------------------------------
create procedure()
language sql
begin atomic
declare ..... (my variables)
declare continue handler for sqlexeption, sqlwarning, not found
begin
set retcode = sqlexception;
end;
for v1 as
select ....
do
insert
GET DIAGNOSTIC EXCEPTION 1 SQLDESCRIP = MESSAGE_TEXT;
end for
end
-------------------------------


the problem is: SQLDESCRIP never return a value o description.
the questionis: any know how work this MESSAGE_TEXT???

TIA
abel-
Reply With Quote
  #2 (permalink)  
Old 01-18-05, 08:56
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
You need to do it this way:

create procedure()
language sql
begin atomic
declare ..... (my variables)
declare continue handler for sqlexeption, sqlwarning, not found
begin
GET DIAGNOSTIC EXCEPTION 1 SQLDESCRIP = MESSAGE_TEXT;
set retcode = sqlexception;
end;
for v1 as
select ....
do
insert
end for
end
-------------------------------

The manual say that the GET DIAGNOSTIC needs to be in the condition handler.

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 01-18-05, 09:08
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
Perfect!!!!!
this work fine!!!

very, very thanks.
Abel.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On