User Guide

Chapter 1: ColdFusion Tags 163
CFPROCRESULT
The CFPROCRESULT tag is nested within a CFSTOREDPROC tag. This tag’s NAME
parameter specifies a result set name that other ColdFusion tags, such as CFOUTPUT
and CFTABLE, use to access the result set. It also allows you to optionally identify
which of the stored procedures result sets to return.
Syntax <CFPROCRESULT NAME="query_name"
RESULTSET="1-n"
MAXROWS="maxrows">
NAME
Required. Name for the query result set.
RESULTSET
Optional. Specify this parameter to identify 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 the same 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>
<!--- 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 --->