cfprocresult

Description

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.

Category

Database manipulation tags

Syntax

<cfprocresult name = "query_name"
  resultSet = "1-n" 
  maxRows = "maxrows"> 

See also

cfinsert, cfprocparam, cfquery, cfqueryparam, cfstoredproc, cftransaction, cfupdate

Attributes

Attribute
Description
name
Required. Name for the query result set.
resultSet
Optional. Identifies the desired result set if the stored procedure returns multiple result sets. Default is 1.
maxRows
Optional. Specifies the maximum number of rows returned in the result set. The default is to return all rows in the result set.

Usage

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.

Example

...
<!--- 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>
...