I have this function declaration
FUNCTION GENSECURE RETURN VARCHAR2;
I am trying to call it in PHP with the following code
$sql="begin :bind = GENSECURE; end";
$s = ociparse($c, $sql);
OCIBindByName($s, ":bind", $user);
$result=ociexecute($s, OCI_DEFAULT);
The last command (ociexecute($s, OCI_DEFAULT); ) can't be executed. Can anyone tell me where am i wrong?
Thanks
Calling ORACLE stored function from php
Moderator: General Moderators
-
Zoran_Dimov
- Forum Newbie
- Posts: 16
- Joined: Wed Jun 21, 2006 6:10 pm
- Location: Macedonia
- Contact:
I have always used adodb as a database access layer to isolate me from the oci* details. Here is a simple example usind adodb (amp_adodb_connection is a factory function returning and adodb connection):
ADOdb is also nice if you have to deal with blobs.
Code: Select all
$ php -r 'require_once "dblogin.php";
$c = amp_adodb_connection("prdcrm");
$c->debug=true;
$rs = $c->executecursor("begin :r := pdftrade_web.getmonths; end;","r");
var_dump(count($rs->getArray()));'
InParameter($stmt, $php_var='', $name='r', $maxLen=-1, $type=116);
-----
(oci8): begin :r := pdftrade_web.getmonths; end;
-----
int(26)