Forgot to add that you can do the cfif outside of the cfstoredproc and
then just use the cfprocparam inside.  Using this method, if
Variables.myPassIn is not zero or "" then it will put FALSE in the NULL
and pass in the value.  If it is zero then it converts to "" and it will
put TRUE in the NULL and pass a null to the procedure.

I do this all the time to ensure that the proper values get to my
procedures.

Steve


-----Original Message-----
From: DURETTE, STEVEN J (ATTASIAIT) 
Sent: Thursday, October 15, 2009 8:59 AM
To: cf-talk
Subject: RE: cfprocparam - null setting


Actually, I think you can solve this problem easily.  If the only two
bad options are zero and "" then try this...

<cfparam name="Variables.myPassIn" default="" />
<cfif Variables.myPassIn is 0>
        <cfset Variables.myPassIn = "" />
</cfif>

<cfprocparam cfsqltype="CF_SQL_INTEGER" value="#Variables.myPassIn#"
null="#not len(Variables.myPassIn)#" />

Of course replace Variables.myPassIn with whatever your variable is.

Steve


-----Original Message-----
From: Kris Jones [mailto:[email protected]] 
Sent: Thursday, October 15, 2009 8:52 AM
To: cf-talk
Subject: Re: cfprocparam - null setting


The former: It ignores anything passed to it, and sets the value to
null.

Note, however, that whatever you are passing to the procparam must still
validate; e.g., a variable in the value attribute must exist:
<cfprocparam .... value="#mygreatvariable#" null="#not
isdefined('mygreatvariable)#">
Will throw a CF error.

Cheers,
Kris


> I have a question about cfprocparam. If I use the "nulll" option, does
it
> ignore anything passed to it and set the value to null or
>
> Does it set a null value when nothing is passed to it.
>
>
>
> I have a stored procedure that chokes on an integer value when either
zero
> or an empty string is passed.
>
> My other option is to pass an exec statement through cfquery and try
to use
> the settable null parameter or cfquery param.
>
>






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327239
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to