OCIDefineByName/OCIBindByName help?
| From: | Barry Prentiss | Date: | Mon, 13 Aug 2001 23:14:24 +0000 |
| Subject: | OCIDefineByName/OCIBindByName help? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-11316@lists.php.net to get a copy of this message | ||
Hi,
Can anyone help me to understand the OCIBindByName/OCIDefineByName
functionality when used with the Oracle 'returning' clause? These two
functions are seriously under-documented at PHP.net.
I need the sequence-generated ID created during an insert for further
manipulation.
I tried sequence-name.currval but got an error.
Here's some code that doesn't work:
$sql = "insert into mdfaq values (null,'$Question','$Answer') returning
ID into :ID";
$stmt = ociParse($conn,$sql);
OCIBindByName($stmt,":ID",&$faq_ID,-1);
ociExecute($stmt);
$sql = "insert into mdfaq_faq_cat values ($faq_ID, $req_cat)";
$stmt = ociParse($conn,$sql);
ociExecute($stmt);
Any Ideas?
Thx in Advance,
Barry Prentiss