Adobe COLDFUSION 9 Manual page 278

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Using stored procedures
The
tag lets ColdFusion use stored procedures in your database management system. A stored
cfstoredproc
procedure is a sequence of SQL statements that is assigned a name, compiled, and stored in the database system. Stored
procedures encapsulate programming logic in SQL statements, and database systems are optimized to execute stored
procedures efficiently. As a result, stored procedures are faster than
You use the
tag to send parameters to the stored procedure, and the
cfprocparam
sets that the stored procedure returns.
The following example executes a Sybase stored procedure that returns three result sets, two of which the example uses.
The stored procedure returns the status code and one output parameter, which the example displays.
<!--- cfstoredproc tag --->
<cfstoredproc procedure = "foo_proc" dataSource = "MY_SYBASE_TEST"
username = "sa" password = "" returnCode = "Yes">
<!--- cfprocresult tags --->
<cfprocresult name = RS1>
<cfprocresult name = RS3 resultSet = 3>
<!--- cfprocparam tags --->
<cfprocparam type = "IN"
CFSQLType = CF_SQL_INTEGER
value = "1">
<cfprocparam type = "OUT"CFSQLType = CF_SQL_DATE
variable = FOO>
<!--- 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>
<br>
<cfoutput>
<hr>
Record Count: #RS1.recordCount#<br>
Columns: #RS1.columnList#<br>
<hr>
</cfoutput>
<cfoutput query = RS3>
#col1#,#col2#,#col3#<br>
</cfoutput>
<br>
<cfoutput>
<hr><br>
Record Count: #RS3.recordCount#<br>
Columns: #RS3.columnList#<br>
<hr>
The return code for the stored procedure is: '#cfstoredproc.statusCode#'<br>
</cfoutput>
cfquery
Last updated 8/5/2010
tags.
tag to get the record
cfprocresult
273

Advertisement

Table of Contents
loading

Table of Contents