|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using SQLSTATE and etc in HANDLER code |
« View previous topic :: View next topic » |
Author |
Message
|
KoGor |
Posted: Thu Jan 11, 2007 4:04 am Post subject: Using SQLSTATE and etc in HANDLER code |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
Hi all!
I have a lack of understanding how to use SQLSTATE,SQLERRORTEXT,SQLNATIVEERROR in my case. I have written the following ESQL code:
....
BEGIN
DECLARE EXIT HANDLER FOR SQLSTATE LIKE '%'
BEGIN
DECLARE qwe REFERENCE TO SDSSegmentStatus;
DECLARE qwe1 CHARACTER SQLSTATE;
RECIEPTERROR : BEGIN
ATOMIC
SET SDSSegmentStatus.MSGSENT[<].IsSent = false;
SET SDSSegmentStatus.MSGSENT[<].ErrorDetail = SQLERRORTEXT;
SET SDSSegmentStatus.MSGSENT[<].ErrorCode = SQLCODE;
SET SDSSegmentStatus.MSGSENT[<].NativeErrorCode = SQLNATIVEERROR;
SET SDSSegmentStatus.MSGSENT[<].SQLState = SQLSTATE;
END RECIEPTERROR;
END;
CREATE LASTCHILD OF SDSSegmentStatus TYPE Name NAME 'MSGSENT';
SET SDSSegmentStatus.MSGSENT[<].LogicalMsgId = SDSLogicalMsgId;
SET SDSSegmentStatus.MSGSENT[<]."Domain" = J."DOMAIN";
SET SDSSegmentStatus.MSGSENT[<].IsSent = true;
SET SDSSegmentStatus.MSGSENT[<].SeqNum = InputRoot.MQMD.MsgSeqNumber;
SET SDSSegmentStatus.MSGSENT[<].ErrorCode = 0;
-- test if there are errors for current domain in previous messages
IF (FailedMsgs <> 0) THEN
THROW USER EXCEPTION MESSAGE 3052 VALUES('One of previous messages failed. We don''t send new msg to this domain.') ;
END IF;
PROPAGATE TO TERMINAL 'out' DELETE NONE;
END;
...
The problem is that I can't get any information about error that happened. As I think Message Broker should populate SQLSTATE and etc. with this information. But all these registers are empty in my handler part in case of any error: throw exception by "THROW USER EXCEPTION" nor some error during PROPAGATE statement.
Is there way to pass error description or my string from "THROW USER EXCEPTION" to HANDLER part?
I'll appreciate any help! |
|
Back to top |
|
 |
mgk |
Posted: Thu Jan 11, 2007 12:05 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
For a User Thrown Exception you have to supply the values for SQLCODE, SQLSTATE etc yourself. The docs say somewhere which order they need to be passed.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
KoGor |
Posted: Thu Jan 11, 2007 11:42 pm Post subject: |
|
|
Voyager
Joined: 09 Nov 2005 Posts: 81 Location: Moscow,Russia.
|
2mgk: thank you for answer. I've looked through documentation but there is nothing about how to get content of VALUES.
I can pass SQLSTATE and etc into variable VALUES of THROW statement. This is example from documentation:
THROW USER EXCEPTION CATALOG ’BIPv600’ MESSAGE 2951 VALUES(’The SQL State: ’, SQLSTATE, ’The SQL Code: ’, SQLCODE, ’The SQLNATIVEERROR: ’, SQLNATIVEERROR, ’The SQL Error Text: ’, SQLERRORTEXT )
Of course I can parse this string but I didn't find the way to get access to this string from HANDLER code. When exception happens there is no ExceptionList or other information about error which I pass by THROW USER EXCEPTION |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|