Specifies a result set name that other ColdFusion tags, such as cfoutput
and cftable, use to access the result set. It also lets you optionally identify which of the stored procedure's result sets to return. The cfprocresult
tag is nested within a cfstoredproc
tag.
<cfprocresult name = "query_name" resultSet = "1-n" maxRows = "maxrows">
cfinsert,
cfprocparam,
cfquery,
cfqueryparam,
cfstoredproc,
cftransaction,
cfupdate
Specify one or more cfprocresult
tags to enable access to data returned by the stored procedure.
resultSet
must be unique within the scope of the cfstoredproc
tag. If you specify a result set twice, the second occurrence overwrites the first.
... <!--- The following example executes a Sybase stored procedure that returns three result sets, two of which we want. The stored procedure returns the status code and one output parameter, which we display. We use named notation for the parameters. ---> <!--- cfstoredproc tag ---> <cfstoredproc procedure = "foo_proc" dataSource = "MY_SYBASE_TEST" username = "sa" password = "" dbServer = "scup" dbName = "pubs2" returnCode = "Yes" debug = "Yes"> <!--- cfprocresult tags ---> <cfprocresult name = RS1> <cfprocresult name = RS3 resultSet = 3> <!--- cfprocparam tags ---> <cfprocparam type = "IN" CFSQLType = CF_SQL_INTEGER value = "1" dbVarName = @param1> <cfprocparam type = "OUT" CFSQLType = CF_SQL_DATE variable = FOO dbVarName = @param2> <!--- Close the cfstoredproc tag ---> </cfstoredproc> <cfoutput> The output param value: '#foo#' <br> </cfoutput> <h3>The Results Information</h3> <cfoutput query = RS1>#name#,#DATE_COL# <br> </cfoutput> <P> <cfoutput> <hr> <P>Record Count: #RS1.recordCount# >p>Columns: #RS1.columnList# <hr> </cfoutput> <cfoutput query = RS3>#col1#,#col2#,#col3# <br> </cfoutput> <P> <cfoutput> <hr> <P>Record Count: #RS3.recordCount# <P>Columns: #RS3.columnList# <hr> The return code for the stored procedure is: '#cfstoredproc.statusCode#'<br> </cfoutput> ...