Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
ora_bind

ora_bind

(PHP 3, PHP 4, PHP 5 <= 5.1.0RC1)

ora_bind -- Binds a PHP variable to an Oracle parameter

Description

bool ora_bind ( resource cursor, string phpvar, string sqlparam, int length [, int type] )

Binds the named PHP variable with a SQL parameter.

ora_bind() must be called after ora_parse() and before ora_exec(). Input values can be given by assignment to the bound PHP variables, after calling ora_exec() the bound PHP variables contain the output values if available.

Parameters

cursor

An Oracle cursor, opened with ora_open().

phpvar

The PHP variable to be bound.

sqlparam

The SQL parameter. Must be in the form :name.

length

type

Defines the type of the parameter. It defaults to ORA_BIND_INOUT. Possible values are listed below:

ConstantValue
ORA_BIND_INOUT0
ORA_BIND_IN1
ORA_BIND_OUT2

Return Values

Returns TRUE on success or FALSE on failure. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.

ChangeLog

VersionDescription
5.1.0

The oracle extension is deprecated in favor of oci8.

3.0.1 The constants for the type were added. In previous versions, you should use the numerical values.

Examples

Example 1. ora_bind() example

&#60;?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&#60;br /&#62;Out: $output&#60;br /&#62;In: $input";
?&#62;

Notes

When using oci8 as a replacement for the deprecated oracle extension, consider using:

oci_bind_by_name()
oci_bind_array_by_name()