★ wanayoo — archive 1999 http://www.php.net/manual/function.ora-bind.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to Oracle
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
Oracle
* Ora_Bind
* Ora_Close
* Ora_ColumnName
* Ora_ColumnType
* Ora_Commit
* Ora_CommitOff
* Ora_CommitOn
* Ora_Error
* Ora_ErrorCode
* Ora_Exec
* Ora_Fetch
* Ora_GetColumn
* Ora_Logoff
* Ora_Logon
* Ora_Open
* Ora_Parse
* Ora_Rollback
Manual: Ora_Bind
View the source code for this pageSearch the site



Previous page
 Oracle
 Updated
Sat, 12 Aug 2000
Ora_Close 
Next page


Ora_Bind

(unknown)

Ora_Bind -- bind a PHP variable to an Oracle parameter

Description

int ora_bind (int cursor, string PHP variable name, string SQL parameter name, int length [, int type])

Returns true if the bind succeeds, otherwise false. Details about the error can be retrieved using the ora_error() and ora_errorcode() functions.

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.

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.


<?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";
?>


User Contributed Notes: Ora_Bind


castle@ruc.dk
29-Dec-1999 10:50
ora_bind looks for the bind variables globally. If your are using ora_bind
from within a class you'll have to delcare the bind variables globally and reference them using eg. $GLOBAL["myVar"].



koos@kzdoos.xs4all.nl
07-Jan-2000 11:39
Passing variables of Oracle type 'DATE' will fail. Just convert them to a string with all the relevant details and convert it back when needed in Oracle, using TO_CHAR and TO_DATE calls in Oracle.


koos@kzdoos.xs4all.nl
28-Feb-2000 09:28
The Oracle parser doesn't like DOS line endings (cr/lf). Save as Unix file (lf line ending only).


 About Notes


Previous page
 Oracle
 Updated
Sat, 12 Aug 2000
Ora_Close 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.