Problem binding variables to Oracle statements

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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
earlier ...
  $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
'Source: Provider
Description: Unspecified error' ....

  Can anyone advise as to what I may be doing wrong with the above?
Many thanks.

Re: Problem binding variables to Oracle statements

Quoted text here. Click to load it

 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 :: :: :: disk and FTP usage analysis tool

Site Timeline