cfprocparam
339
Output variables are stored in the ColdFusion variable specified by the
variable
attribute.
You cannot use the
cfprocparam
tag for Oracle 8 and 9 reference cursors. Instead, use the
cfprocresult
tag.
Example
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:
•
Parameter
pParam1
returns the rows in the EMP table
•
Parameter
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"
Summary of Contents for COLFUSION MX 7-CFML
Page 1: ...COLDFUSION MX7 CFML Reference...
Page 20: ...20 Chapter 1 Reserved Words and Variables...
Page 50: ...50 Chapter 2 ColdFusion Tags cfelse br Searching cfif cfloop cfif...
Page 101: ...cfdefaultcase 101 cfdefaultcase cfswitch cfoutput Your grade is grade cfoutput...
Page 115: ...cfdocumentsection 115 cfdocumentsection cfoutput cfdocument...
Page 411: ...cftable 411 cftable body html...
Page 515: ...Chr 515 maxlength 5 p input type Submit name input type RESET cfform...
Page 605: ...GetEncoding 605 WriteOutput The encoding is theEncoding cfscript cfif...
Page 629: ...GetProfileString 629 tr td input type Submit name Submit value Submit td td td tr table form...
Page 655: ...IIf 655 cfoutput IIf Hour Now GTE 12 DE It is afternoon or evening DE It is morning cfoutput b...
Page 664: ...664 Chapter 3 ColdFusion Functions cfelse h3 Conversion error h3 cfif...
Page 687: ...IsStruct 687 cfoutput cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 751: ...LSDateFormat 751 hr noshade cfoutput cfloop...
Page 861: ...StructFind 861 cfquery cfif cfoutput hr Employee Add Complete cfoutput cfcase cfswitch...
Page 903: ...Val 903 value Is the beginning numeric name form...
Page 932: ...932 Chapter 3 ColdFusion Functions...
Page 944: ...944 Chapter 4 ColdFusion MX Flash Form Style Reference...
Page 962: ...962 Chapter 5 Application CFC Reference...
Page 1054: ...1054 Chapter 6 ColdFusion MX Event Gateway Reference...