<html>
<head>
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFPROCPARAM</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="Description">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFPROCPARAM</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Description</span>
<p>
Defines stored procedure parameters. This tag is nested within a cfstoredproc tag. 
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Category</span>
<p>
Database manipulation tags
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">Syntax</span><pre>&lt;cfprocparam 
   type = &quot;in&quot; or &quot;out&quot; or &quot;inout&quot;
   variable = &quot;variable name&quot;
   value = &quot;parameter value&quot;
   CFSQLType = &quot;parameter datatype&quot;
   maxLength = &quot;length&quot;
   scale = &quot;decimal places&quot; 
   null = &quot;yes&quot; or &quot;no&quot;&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">See also</span>
<p>
cfinsert, cfprocresult, cfquery, cfqueryparam, cfstoredproc, cftransaction, cfupdate; "Optimizing ColdFusion applications" in Chapter&#160;13, "Designing and Optimizing a ColdFusion&#160;Application," in ColdFusion MX Developer's Guide
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">History</span>
<p>
ColdFusion&#160;MX: 
</p>
<ul>

<li>The maxrows attribute is obsolete. </li>

<li>Changed the dbvarname attribute behavior: it is now ignored for all drivers. ColdFusion MX uses JDBC 2.2 and does not support named parameters.</li>

<li>Changed the maxLength attribute behavior: it now applies to IN and INOUT parameter values.</li>
</ul>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Usage</span>
<p>
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. ColdFusion MX supports positional parameters only and you must code cfprocparam tags in the same order as the associated parameters in the stored procedure definition.
</p>

<p>
Output variables are stored in the ColdFusion variable specified by the variable attribute.
</p>

<p>
You cannot use the cfprocparam tag for Oracle 8 and 9 reference cursors. Instead, use the cfprocresult tag.
</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">Example</span>
<p>
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.
</p>

<p>
The following package, Foo_Data, houses a procedure refcurproc that declares output parameters as Reference Cursor:
</p>
<ul>

<li>Parameter pParam1 returns the rows in the EMP table</li>

<li>Parameter pParam2 returns the rows in the DEPT table </li>
</ul>

<p>
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.
</p>
<pre>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 : = &#39;hello&#39;;
      ELSE
         pParam4 : = &#39;goodbye&#39;;
      END IF;
   END RefCurProc;
END Foo_Data;
</pre>
<p>
The following CFML example shows how to invoke the RefCurProc procedure using cfstoredproc, cfprocparam, and cfprocresult:
</p>
<pre>&lt;cfstoredproc&#160;&#160;procedure = &quot;foo_data.refcurproc&quot;
   dataSource = &quot;oracle8i&quot; 
   username = &quot;scott&quot;
   password = &quot;tiger&quot;
   returnCode = &quot;No&quot;&gt;

   &lt;cfprocparam type = &quot;Out&quot; CFSQLType = &quot;CF_SQL_REFCURSOR&quot; 
      variable = &quot;param1&quot;&gt;
   &lt;cfprocparam type = &quot;Out&quot; CFSQLType = &quot;CF_SQL_REFCURSOR&quot;
      variable = &quot;param2&quot;&gt;
   &lt;cfprocparam type = &quot;IN&quot; CFSQLType = &quot;CF_SQL_INTEGER&quot; value = &quot;1&quot;&gt;

   &lt;cfprocparam type = &quot;OUT&quot; CFSQLType = &quot;CF_SQL_VARCHAR&quot; 
      variable = &quot;FOO&quot;&gt;
   &lt;cfprocresult name = &quot;rs1&quot;&gt;
   &lt;cfprocresult name = &quot;rs2&quot; resultSet = &quot;2&quot;&gt;
&lt;/cfstoredproc&gt;

&lt;b&gt;The first result set:&lt;/b&gt;&lt;br&gt;
&lt;hr&gt;
&lt;cftable query = &quot;rs1&quot; colHeaders HTMLTable border = &quot;1&quot;&gt;
   &lt;cfcol header = &quot;EMPNO&quot; text = &quot;#EMPNO#&quot;&gt;
   &lt;cfcol header = &quot;EMPLOYEE name&quot; text = &quot;#ENAME#&quot;&gt;
   &lt;cfcol header = &quot;JOB&quot; text = &quot;#JOB#&quot;&gt;
   &lt;cfcol header = &quot;SALARY&quot; text = &quot;#SAL#&quot;&gt;
   &lt;cfcol header = &quot;DEPT NUMBER&quot; text = &quot;#DEPTNO#&quot;&gt;
&lt;/cftable&gt;

&lt;hr&gt;
&lt;b&gt;The second result set:&lt;/b&gt;&lt;br&gt;

&lt;cftable query = &quot;rs2&quot; colHeaders HTMLTable border = &quot;1&quot;&gt;
   &lt;cfcol header = &quot;DEPT name&quot; text = &quot;#DNAME#&quot;&gt;
   &lt;cfcol header = &quot;DEPT NUMBER&quot; text = &quot;#DEPTNO#&quot;&gt;
&lt;/cftable&gt;
&lt;hr&gt;
&lt;cfoutput&gt;
   &lt;b&gt;The output parameter is:&lt;/b&gt;&#39;#FOO#&#39;
&lt;/cfoutput&gt;
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="TYPE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">TYPE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "in"

<ul>

<li>in: the parameter is used to send data to the database system only. Passes the parameter by value. </li>

<li>out: the parameter is used to receive data from the database system only. Passes the parameter as a bound variable.</li>

<li>inout: the parameter is used to send and receive data. Passes the parameter as a bound variable.</li>
</ul>


  </td>
  </tr>
  </table>
</div>
<div id="VARIABLE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VARIABLE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if type = &quot;OUT&quot; or &quot;INOUT&quot; </td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ColdFusion variable name; references the value that the output parameter has after the stored procedure is called. This is ignored for IN parameters.</p>

  </td>
  </tr>
  </table>
</div>
<div id="VALUE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">VALUE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required if type = &quot;IN&quot;</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>Value that ColdFusion passes to the stored procedure.This is optional for INOUT parameters.</p>

  </td>
  </tr>
  </table>
</div>
<div id="CFSQLTYPE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">CFSQLTYPE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Required</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>SQL type to which the parameter (any type) is bound. ColdFusion supports the following values, where the last element of the name corresponds to the SQL data type. Different database systems might support different subsets of this list. See your DBMS documentation for information on supported parameter types.</p><ul>

<li>CF_SQL_BIGINT</li>

<li>CF_SQL_BIT</li>

<li>CF_SQL_BLOB</li>

<li>CF_SQL_CHAR</li>

<li>CF_SQL_CLOB</li>

<li>CF_SQL_DATE</li>

<li>CF_SQL_DECIMAL</li>

<li>CF_SQL_DOUBLE</li>

<li>CF_SQL_FLOAT</li>

<li>CF_SQL_IDSTAMP</li>

<li>CF_SQL_INTEGER</li>

<li>CF_SQL_LONGVARCHAR</li>

<li>CF_SQL_MONEY</li>

<li>CF_SQL_MONEY4</li>

<li>CF_SQL_NUMERIC</li>

<li>CF_SQL_REAL</li>

<li>CF_SQL_REFCURSOR</li>

<li>CF_SQL_SMALLINT</li>

<li>CF_SQL_TIME</li>

<li>CF_SQL_TIMESTAMP</li>

<li>CF_SQL_TINYINT</li>

<li>CF_SQL_VARCHAR</li>
</ul>

<p>For a mapping of ColdFusion SQL data types to JDBC data types, See also cfqueryparam.</p>

  </td>
  </tr>
  </table>
</div>
<div id="MAXLENGTH">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">MAXLENGTH</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "0"


<p>Maximum length of a string or character IN or INOUT value attribute. A maxLength of 0 allows any length. The maxLength attribute is not required when specifying type=out.</p>

  </td>
  </tr>
  </table>
</div>
<div id="SCALE">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">SCALE</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "0"


<p>Number of decimal places in numeric parameter. A scale of 0 limits the value to an integer. </p>

  </td>
  </tr>
  </table>
</div>
<div id="NULL">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">NULL</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">Optional</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">

<strong>Default value:</strong> "No"


<p>Whether the parameter is passed in as a null value. Not used with OUT type parameters.</p><ul>

<li>Yes: tag ignores the value attribute.</li>

<li>No</li>
</ul>


  </td>
  </tr>
  </table>
</div>

  </body>
</html>
