cfprocresult

Description

Result set name that other ColdFusion tags, such as cfoutput and cftable, use to access a result set. Identifies which of the stored procedure's result sets to return. This 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 Req/Opt Default Description
name
Required
 
Name for the query result set.
resultSet
Optional
1
Names one result set, if stored procedure returns more than one.
maxRows
Optional
-1 (All)
Maximum number of rows returned in result set.

Usage

To enable access to data returned by the stored procedure, specify one or more cfprocresult tags.

The resultSet attribute must be unique within the scope of the cfstoredproc tag. If you specify a result set twice, the second occurrence overwrites the first.

Example

<!--- This example executes a Sybase stored procedure that returns three 
result sets, two of which we want. The stored procedure returns 
status code and one output parameter, which we display. We use 
named notation for 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>
...

Comments