|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Handling NULL values in Procedure(function) |
« View previous topic :: View next topic » |
Author |
Message
|
mahek |
Posted: Wed Jun 29, 2005 7:17 am Post subject: Handling NULL values in Procedure(function) |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
Hi all,
This is the error that i am getting while calling a Procedure
A function or procedure was called but the value supplied for the 'inputValue' parameter was of type 'NULL' but the function/procedure expects value of type 'CHARACTER' Functions and procedures require an exact matching between the data type of values supplied as parameters and the data type in its definition. Examine and correct the SQL program
Here is that Procedure that i am using
setVendorProductUpdate(IN inputValue CHAR,IN tagName CHAR, INOUT VendorProductUpdateCounter INTEGER )
The inputValue(the first parameter in theprocedure) can be NULL .When the inputValue is not null the code is working properly but when it is null it is giving this error . |
|
Back to top |
|
 |
JT |
Posted: Wed Jun 29, 2005 7:35 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Post the ESQL code leading up to, and including the CALL statement. |
|
Back to top |
|
 |
mahek |
Posted: Wed Jun 29, 2005 8:31 am Post subject: |
|
|
Voyager
Joined: 10 Sep 2004 Posts: 87
|
SET OutputRoot.XMLNS."mms-txn:MMSTransaction"."mms-txn:MMSTransactionBody"."product:Product"."product:VendorProductUpdate"."product:Field"[VendorProductUpdateCounter]=TRIM(InputRoot.MRM.SP_INYUPC_IUPC);
SET OutputRoot.XMLNS."mms-txn:MMSTransaction"."mms-txn:MMSTransactionBody"."product:Product"."product:VendorProductUpdate"."product:Field"[VendorProductUpdateCounter].(XML.attr)NAME='SellUPC';
SET VendorProductUpdateCounter= VendorProductUpdateCounter+1;
CALL setVendorProductUpdate( InputRoot.MRM.SP_INVMST_IDESCR,'Vendordescrip',VendorProductUpdateCounter);
CREATE PROCEDURE setVendorProductUpdate(INOUT inputValue CHAR,IN tagName CHAR, INOUT VendorProductUpdateCounter INTEGER ) BEGIN
IF inputValue is not NULL THEN
SET OutputRoot.XMLNS."mms-txn:MMSTransaction"."mms-txn:MMSTransactionBody"."product:Product"."product:VendorProductUpdate"."product:Field"[VendorProductUpdateCounter]=TRIM(inputValue);
SET OutputRoot.XMLNS."mms-txn:MMSTransaction"."mms-txn:MMSTransactionBody"."product:Product"."product:VendorProductUpdate"."product:Field"[VendorProductUpdateCounter].(XML.attr)NAME=tagName;
SET VendorProductUpdateCounter= VendorProductUpdateCounter+1;
END IF;
END; |
|
Back to top |
|
 |
Maximreality |
Posted: Thu Jun 30, 2005 6:31 am Post subject: |
|
|
 Acolyte
Joined: 04 Jun 2004 Posts: 65 Location: Copenhagen
|
You can use Coalesce and provide a second parameter that has a default value that indicates the first value is Null
Code: |
CALL setVendorProductUpdate(COALESCE(InputRoot.MRM.SP_INVMST_IDESCR, '||'),'Vendordescrip',VendorProductUpdateCounter); |
Code: |
CREATE PROCEDURE setVendorProductUpdate(INOUT inputValue CHAR,IN tagName CHAR, INOUT VendorProductUpdateCounter INTEGER ) BEGIN
IF inputValue = '||' THEN
Do your stuff here if the value is Null;
END IF; |
/Rasmus |
|
Back to top |
|
 |
mgk |
Posted: Thu Jun 30, 2005 10:28 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
I'm not sure what level of the broker you are running, but their is a known problem with an exception being thrown when passing NULL to an IN or INOUT parameter to a procedure. If you raise a PMR you should be able to get an efix (I'm not sure if this is in V5 CSD5 or not.) It is certainly not in CSD4 or earlier...
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 |
|
 |
|
|
 |
|
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
|
|
|
|