cfstoredproc

Executes a stored procedure in a server database. It
specifies database connection information and identifies
the stored procedure.

  <cfstoredproc procedure="">

 cfstoredproc(procedure="");

Attribute Reference

procedure string
Required

Name of stored procedure on database server.

datasource string

Name of data source that points to database that contains
stored procedure.

username string

Overrides username in data source setup.

password string

Overrides password in data source setup.

blockfactor numeric

Maximum number of rows to get at a time from server.
Range is 1 to 100.

debug boolean
Default: false

Yes: Lists debug information on each statement
No: does not
Values:
  • true
  • false

returncode boolean
Default: false

Yes: Tag populates cfstoredproc.statusCode with status
code returned by stored procedure.
No: does not
Values:
  • true
  • false

result variableName

Specifies a name for the structure in which cfstoredproc
returns the statusCode and ExecutionTime variables. If
set, this value replaces cfstoredproc as the prefix to
use when accessing those variables.

Examples
Sample code using the cfstoredproc tag

Basic example of calling a stored procedure, passing a parameter, and getting a result set.

<cfstoredproc procedure="spu_my_storedproc" datasource="myDSN">
	<cfprocparam cfsqltype="cf_sql_integer" value="#myParameterValue#">
	<cfprocresult name="qResults">
</cfstoredproc>

Call stored procedure and get back multiple result sets.

cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) {
	cfprocparam( cfsqltype="cf_sql_date", value=myDateParam );
	cfprocresult( name="qSummary", resultset=1 );
	cfprocresult( name="qDetails", resultset=2 );
}

Call stored procedure and get back multiple result sets.

cfstoredproc( procedure="spu_my_storedproc",datasource="myDSN" ) {
	procparam( cfsqltype="cf_sql_date", value=myDateParam );
	procresult( name="qSummary", resultset=1 );
	procresult( name="qDetails", resultset=2 );
}

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub