note 36718 added to function.ora-bind
| From: | cjbj at hotmail dot com | Date: | Mon, 20 Oct 2003 09:01:34 +0000 |
| Subject: | note 36718 added to function.ora-bind | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58924@lists.php.net to get a copy of this message | ||
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;
?>
----
Manual Page -- http://www.php.net/manual/en/function.ora-bind.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36718
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36718&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36718&report=yes
Search -- http://master.php.net/manage/user-notes.php