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 > Signal Resignal

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-03, 08:38
haburai haburai is offline
Registered User
 
Join Date: Dec 2003
Posts: 10
Signal Resignal

Hello,

I have a problem with SIGNAL and RESIGNAL statements. May I call these statements at another place in SQL stored procedure like in CONDITION HANDLER ? Still I was not successful. If yes can you send me any example?

Thanks for answer.
Reply With Quote
  #2 (permalink)  
Old 12-08-03, 09:25
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Yes,

THis is taken straight out of the V8.1 SQL Reference:

CREATE PROCEDURE SUBMIT_ORDER
(IN ONUM INTEGER, IN CNUM INTEGER,
IN PNUM INTEGER, IN QNUM INTEGER)
SPECIFIC SUBMIT_ORDER
MODIFIES SQL DATA
LANGUAGE SQL
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE VALUE '23503'
SIGNAL SQLSTATE '75002'
SET MESSAGE_TEXT = 'Customer number is not known';
INSERT INTO ORDERS (ORDERNO, CUSTNO, PARTNO, QUANTITY)
VALUES (ONUM, CNUM, PNUM, QNUM);
END

HTH

Andy
Reply With Quote
  #3 (permalink)  
Old 12-08-03, 09:31
haburai haburai is offline
Registered User
 
Join Date: Dec 2003
Posts: 10
Quote:
Originally posted by ARWinner
Yes,

THis is taken straight out of the V8.1 SQL Reference:

CREATE PROCEDURE SUBMIT_ORDER
(IN ONUM INTEGER, IN CNUM INTEGER,
IN PNUM INTEGER, IN QNUM INTEGER)
SPECIFIC SUBMIT_ORDER
MODIFIES SQL DATA
LANGUAGE SQL
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE VALUE '23503'
SIGNAL SQLSTATE '75002'
SET MESSAGE_TEXT = 'Customer number is not known';
INSERT INTO ORDERS (ORDERNO, CUSTNO, PARTNO, QUANTITY)
VALUES (ONUM, CNUM, PNUM, QNUM);
END

HTH

Andy


Thanks, but I would like to put SIGNAL statement into other place of procedures body, not only in HANDLER. This is my problem.
Reply With Quote
  #4 (permalink)  
Old 12-08-03, 09:37
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Yes, you should be able to use it outside a CONDITION statement. Could you post what you are trying to do (code) and tell me what you want it to do, maybe then I can help.

Andy
Reply With Quote
  #5 (permalink)  
Old 12-08-03, 10:05
haburai haburai is offline
Registered User
 
Join Date: Dec 2003
Posts: 10
Quote:
Originally posted by ARWinner
Yes, you should be able to use it outside a CONDITION statement. Could you post what you are trying to do (code) and tell me what you want it to do, maybe then I can help.

Andy
I don' t understand. Now everything works good, and 2 day ago I got error messages.

Thank you.
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