note 36718 deleted from function.ora-bind by philip
| From: | philip@php.net | Date: | Fri, 18 Apr 2008 05:04:42 +0000 |
| Subject: | note 36718 deleted from function.ora-bind by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138448@lists.php.net to get a copy of this message | ||
Note Submitter: cjbj at hotmail dot com
----
Ahmed's solution is based on the sample given to him in http://forums.oracle.com/forums/thread.jsp?forum=178&thread=206340
Here's a similar example answering the question
"How do I get the return value from a PL/SQL function?"
<?php
/*
Sample using "oracle" driver to get the value of a PL/SQL function.
Before running this script create this function using SQL*Plus:
create or replace function myfunc(myparam IN varchar2) return varchar2 as
begin
return myparam;
end;
Tested with PHP 4.3.3 against Oracle 9.2
*/
$my_db_conn = ora_logon("scott@mydb", "tiger");
$my_cursor = ora_open($my_db_conn);
$sql = "begin :mybindvar := myfunc('abcde'); end;";
ora_parse($my_cursor, $sql, 0);
$r = ora_bind($my_cursor, "mybindvar", ":mybindvar", 5, 1);
// Set the OUT bind variable to anything (?), else get:
// Warning: Can't find variable for parameter
// Notice: Undefined variable: mybindvar
$mybindvar = NULL;
ora_exec($my_cursor);
print 'Return value is: '. $mybindvar;
?>