Skip to main content
Participant
January 26, 2009
Question

cffunction returntype question

  • January 26, 2009
  • 2 replies
  • 502 views
I've got a function (below) in a CFC that executes a stored procedure. The procedure has 2 input parameters and a single output parameter. I want to cfoutput the value of the output parameter in the procedure. The procedure does it's job in CF if I don't return the output parameter. I keep having problems with the returnvariable type. I've output returntypes of query in the past without any problem, but never a single calculated value. The value being output by the procedure is a long integer.


<!--- FUNCTION --->
<cffunction name="myFunctTest" hint="ProcedureTest" returntype="??????">
<cftry>
<cfstoredproc procedure="myProc" username='#this.user#' password='#this.pass#' datasource='#this.dSource#'>
<cfprocparam type="Out" cfsqltype="cf_sql_integer" variable="OutputID"><!--- Output variable I want to return --->
<cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" value='#this.par1#' dbvarname="myPar1">
<cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" value='#this.par2#'dbvarname="myPar2">
</cfstoredproc>
<cfcatch type="any">
<cfreturn "Error in Function...">
</cfcatch>
</cftry>
<cfreturn ??????>
</cffunction>

<!--- FUNCTION CALL --->
<cfinvoke component="cfc.myCFC" method="myFunctTest" returnvariable="??????">
<cfinvokeargument name="user" value="#myUser#">
<cfinvokeargument name="pass" value="#MyPass#">
<cfinvokeargument name="dSource" value="#myDSource#">
<cfinvokeargument name="par1" value="#Form.MyPar1#">
<cfinvokeargument name="par2" value="#Form.MyPar2#">

</cfinvoke>

Thanks in advance
Roy.
    This topic has been closed for replies.

    2 replies

    Inspiring
    January 26, 2009
    Combine,

    Are your stored procedure parameters defined in the same order you are using them in your CFSTOREDPROC tag? Bear in mind that the dbvarname attribute is ignored in CF6+.
    Inspiring
    January 26, 2009
    Well there is the returnType="numeric" or any of the other available
    return types listed in the documentation.