Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
December 14, 2005, 1:52 pm
rate this thread
I'm experimenting with PHP5, ORacle 9i and ADODB and have run into
problems trying to bind and output variable.
I can make a successful connection to our database via the MSDAORA
provider but the following simple statement will not work:
$oCMD = new COM("ADODB.command");
$oCMD->ActiveConnection = $dbConn; /// $dbConn generated
$oCMD->Prepared = True;
$oCMD->CommandText = "SELECT 12345 INTO :num FROM dual";
$ans = $oCMD->Parameters->Item("num")->Value;
echo "answer: [$ans] <br />";
This generates the following : answer: 
I've tried binding via the '?' spaceholder as I've been told that
can be used as well but it fails with the following:
Fatal error: Uncaught exception 'com_exception' with message
Description: Unspecified error' ....
Can anyone advise as to what I may be doing wrong with the above?
Re: Problem binding variables to Oracle statements
Can't really help with the exact question, but why are you running through
ODBC/ADO/COM when you could use the much better native Oracle support?
Performance, portability and reliability will be better.
In fact there's the (potentially confusingly named) ADOdb library (which has
nothing to do with Windows' ADODB other than a vaguely similar interface) that
does a good job of wrapping up the various PHP native database libraries into a
consistent interface; I use it extensively on Oracle 9i.
Andy Hassall :: email@example.com :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool