ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems with NULL and procedures

Post new topic  Reply to topic
 Problems with NULL and procedures « View previous topic :: View next topic » 
Author Message
sorn73
PostPosted: Mon Sep 13, 2004 11:30 am    Post subject: Problems with NULL and procedures Reply with quote

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
View user's profile Send private message
mgk
PostPosted: Mon Sep 13, 2004 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
RocknRambo
PostPosted: Mon Sep 13, 2004 12:48 pm    Post subject: Reply with quote

Partisan

Joined: 24 Sep 2003
Posts: 355

The broker parser is 'NULL' as the keyword I believe.
Back to top
View user's profile Send private message
Ramphart
PostPosted: Mon Sep 13, 2004 11:36 pm    Post subject: Re: Problems with NULL and procedures Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Problems with NULL and procedures
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.