php-doc-en/reference/oracle/functions/ora-bind.xml

78 lines
2.7 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- splitted from ./en/functions/oracle.xml, last change in rev 1.2 -->
<refentry id="function.ora-bind">
<refnamediv>
<refname>Ora_Bind</refname>
<refpurpose>bind a PHP variable to an Oracle parameter</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>ora_bind</methodname>
<methodparam><type>int</type><parameter>cursor</parameter></methodparam>
<methodparam><type>string</type><parameter>PHP variable name</parameter></methodparam>
<methodparam><type>string</type><parameter>SQL parameter name</parameter></methodparam>
<methodparam><type>int</type><parameter>length</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>type</parameter></methodparam>
</methodsynopsis>
<para>
Returns &true; if the bind succeeds, otherwise &false;. Details
about the error can be retrieved using the
<function>ora_error</function> and
<function>ora_errorcode</function> functions.
</para>
<para>
This function binds the named PHP variable with a SQL parameter.
The SQL parameter must be in the form ":name". With the optional
type parameter, you can define whether the SQL parameter is an
in/out (0, default), in (1) or out (2) parameter. As of PHP
3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN and
ORA_BIND_OUT instead of the numbers.
</para>
<para>
ora_bind must be called after <function>ora_parse</function> and
before <function>ora_exec</function>. Input values can be given
by assignment to the bound PHP variables, after calling
<function>ora_exec</function> the bound PHP variables contain the output
values if available.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
ora_parse($curs, "declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; end;");
ora_bind($curs, "result", ":x", $len, 2);
ora_bind($curs, "input", ":in", 5, 1);
ora_bind($curs, "output", ":out", 5, 2);
$input = 765;
ora_exec($curs);
echo "Result: $result<BR>Out: $output<BR>In: $input";
?>
]]>
</programlisting>
</informalexample>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->