You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by yo...@tcs.com on 2006/07/07 16:00:09 UTC

Null parameter value to stored procedure

Hi,

i am trying to pass null parameter value to stored procedure

ex:

<procedure id="Search" parameterClass="java.util.HashMap"
            resultMap="results">

            { call testStoredProc(#id#)}

</procedure>

sometimes id parameter value comes from the HashMap contains null value.

how ibatis handles this and how can i configure....? i am getting error
when i pass null value.

I tried with passing default value like this { call
testStoredProc(#id:NUMERIC:-1#)} and it works.

Question is without assigning default value for the parameter is there any
other way i can resolve this.

thanks in advance
Yogish
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: Null parameter value to stored procedure

Posted by puneet arya <pu...@yahoo.co.in>.
Hi,
    In ur sqlmap dao u can write   
IF(object != null) 
{
Do what ever u want
}
The object through which u r passing or getting value 

Other catch the exception through exception block . now it is upto u ki u want to catch exception at sql level or java level.

Regards,
Puneet Arya
 
yogisha.b@tcs.com wrote: Hi,

i am trying to pass null parameter value to stored procedure

ex:



            resultMap="results">

            { call testStoredProc(#id#)}




sometimes id parameter value comes from the HashMap contains null value.

how ibatis handles this and how can i configure....? i am getting error
when i pass null value.

I tried with passing default value like this { call
testStoredProc(#id:NUMERIC:-1#)} and it works.

Question is without assigning default value for the parameter is there any
other way i can resolve this.

thanks in advance
Yogish
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




 				
---------------------------------
 Find out what India is talking about on  Yahoo! Answers India.
 So, whatÂ’s NEW about the NEW Yahoo! Messenger? Find out.