|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Problems with NULL and procedures |
« View previous topic :: View next topic » |
Author |
Message
|
sorn73 |
Posted: Mon Sep 13, 2004 11:30 am Post subject: Problems with NULL and procedures |
|
|
Novice
Joined: 24 Mar 2004 Posts: 24 Location: Sweden
|
Hello.
I'm on WBIMB 5.0.2 on Windows and AIX, and I'm suddenly having problems with ESQL procedures and NULL values. If I read the WBIMB help it says "IN and INOUT parameters can be NULL when received by the procedure."
So why am I getting an Exception from this code? When I debug I get the exception just when I execute the CALL().
Code: |
CREATE COMPUTE MODULE Dummy_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL Aaa(NULL);
RETURN TRUE;
END;
CREATE PROCEDURE Aaa ( IN InChar CHARACTER ) BEGIN
DECLARE OutChar CHARACTER InChar;
SET OutChar = InChar;
END;
END MODULE; |
|
|
Back to top |
|
 |
mgk |
Posted: Mon Sep 13, 2004 12:18 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
The Help seems to be slightly unhelpful on this point. The problem is that the NULL literal does not have a data type, so whilst you can pass a variable that has a NULL value, you cannot pass NULL the literal, as there is no implicit casting between types when invoking a function or a procedure.
The following line should work for you as nullCHAR is a variable of type character with a NULL value as described above.
Code: |
DECLARE nullCHAR CHARACTER;
CALL Aaa(nullCHAR); |
_________________ 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 |
|
 |
RocknRambo |
Posted: Mon Sep 13, 2004 12:48 pm Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
The broker parser is 'NULL' as the keyword I believe. |
|
Back to top |
|
 |
Ramphart |
Posted: Mon Sep 13, 2004 11:36 pm Post subject: Re: Problems with NULL and procedures |
|
|
 Disciple
Joined: 21 Jul 2004 Posts: 150 Location: South Africa, JHB
|
sorn73 wrote: |
CREATE PROCEDURE Aaa ( IN InChar CHARACTER ) BEGIN
DECLARE OutChar CHARACTER InChar;
SET OutChar = InChar;
END;
|
Maybe you can use the COALESCE funtion when you do your procedure call.
DECLARE value CHAR;
DECLARE result CHAR;
Set value = COALESCE(value,'');
Set result = Aaa(value);
You can try to do it all in one go like:
Set result = Aaa(COALESCE(value,''));
but I know there was an issue with passing a function call as a parameter at one stage.
Regards.
_________________ Applications Architect |
|
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
|
|
|
|