Parameter information. This tag is nested within a cfstoredproc tag.
<cfprocparam type = "in" or "out" or "inout" variable = "variable name" dbVarName = "DB variable name" value = "parameter value" CFSQLType = "parameter datatype" maxLength = "length" scale = "decimal places" null = "Yes" or "No">
cfinsert, cfprocresult, cfquery, cfqueryparam, cfstoredproc, cftransaction, cfupdate
Use this tag to identify stored procedure parameters and their data types. Code one cfprocparam tag for each parameter. The parameters that you code vary based on parameter type and DBMS. The order in which you code cfprocparam tags depends on whether the stored procedure uses positional or named notation:
dbVarName for the parameter must correspond to the variable name in the stored procedure on the server
Output variables are scoped with the name of the variable attribute passed to the tag.
CFML supports Oracle 8 Reference Cursor type, which passes a parameter by reference. Parameters that are passed this way can be allocated and deallocated from memory within the execution of one application.
To use reference cursors in packages or stored procedures, use the cfprocresult tag. This causes Datadirect JDBC to put Oracle reference cursors into a result set. (You cannot use this method with Oracle's ThinClient JDBC drivers.)
The following example shows how to invoke an Oracle 8 PL/SQL stored procedure. It makes use of Oracle 8 support of the Reference Cursor type.
The following package, Foo_Data, houses a procedure refcurproc that declares output parameters as Reference Cursor:
pParam1 returns the rows in the EMP table
pParam2 returns the rows in the DEPT table
The procedure declares one input parameter as an integer, and one output parameter as a two-byte char varying type. Before the cfstoredproc tag can call this procedure, it must be created, compiled, and bound in the RDBMS environment.
CREATE OR REPLACE PACKAGE Foo_Data AS
TYPE EmpTyp IS REF CURSOR RETURN Emp%ROWTYPE;
TYPE DeptTyp IS REF CURSOR RETURN Dept%ROWTYPE;
PROCEDURE refcurproc(pParam1 in out EmpTyp, pParam2 in out DeptTyp,
pParam3 in integer, pParam4 out varchar2);
END foo_data;
CREATE OR REPLACE PACKAGE BODY Foo_Data AS
PROCEDURE RefCurProc(pParam1 in out EmpTyp,
pParam2 in out DeptTyp,
pParam3 in integer,
pParam4 out varchar2) IS
BEGIN
OPEN pParam1 FOR select * from emp;
OPEN pParam2 FOR select * from dept;
IF pParam3 = 1
THEN
pParam4 : = 'hello';
ELSE
pParam4 : = 'goodbye';
END IF;
END RefCurProc;
END Foo_Data;
The following CFML example shows how to invoke the RefCurProc procedure using cfstoredproc, cfprocparam, and cfprocresult.
<cfstoredproc procedure = "foo_data.refcurproc"
dataSource = "oracle8i"
username = "scott"
password = "tiger"
returnCode = "No">
<cfprocparam type = "Out" CFSQLType = "CF_SQL_REFCURSOR"
variable = "param1">
<cfprocparam type = "Out" CFSQLType = "CF_SQL_REFCURSOR"
variable = "param2">
<cfprocparam type = "IN" CFSQLType = "CF_SQL_INTEGER" value = "1">
<cfprocparam type = "OUT" CFSQLType = "CF_SQL_VARCHAR"
variable = "FOO">
<cfprocresult name = "rs1">
<cfprocresult name = "rs2" resultSet = "2">
</cfstoredproc>
<b>The first result set:</b><br>
<hr>
<cftable query = "rs1" colHeaders HTMLTable border = "1">
<cfcol header = "EMPNO" text = "#EMPNO#">
<cfcol header = "EMPLOYEE name" text = "#ENAME#">
<cfcol header = "JOB" text = "#JOB#">
<cfcol header = "SALARY" text = "#SAL#">
<cfcol header = "DEPT NUMBER" text = "#DEPTNO#">
</cftable>
<hr>
<b>The second result set:</b><br>
<cftable query = "rs2" colHeaders HTMLTable border = "1">
<cfcol header = "DEPT name" text = "#DNAME#">
<cfcol header = "DEPT NUMBER" text = "#DEPTNO#">
</cftable>
<hr>
<cfoutput>
<b>The output parameter is:</b>'#FOO#'
</cfoutput>
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting
Version 6
Comments are no longer accepted for ColdFusion MX. ColdFusion 8 is the current version.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/6/CFML_Reference/Tags-pt215.htm
Comments
kjabbour@macromedia. said on Jul 2, 2002 at 6:51 PM : crisostomo said on Jun 10, 2002 at 12:54 PM : paross1 said on Jul 2, 2002 at 5:36 PM : rbils@amkor.com said on Jun 28, 2002 at 1:48 PM : fusebox_steve said on Jul 1, 2002 at 10:25 PM : kjabbour@macromedia. said on Jul 2, 2002 at 6:51 PM : xrubin said on Jul 5, 2002 at 7:43 PM : ctina said on Jul 25, 2002 at 8:47 PM : pfreitag said on Aug 18, 2002 at 4:59 PM : rnielsen said on Dec 5, 2002 at 1:06 PM : luckydoginLR said on Mar 27, 2003 at 5:00 PM : luckydoginLR said on Mar 27, 2003 at 5:11 PM : luckydoginlr said on Mar 28, 2003 at 5:32 PM : TrinityNeo said on Oct 28, 2003 at 5:23 PM : No screen name said on Nov 7, 2003 at 8:01 AM :