NYCPHP Meetup

NYPHP.org

[nycphp-talk] oci8 bind error

Hans Zaunere lists at zaunere.com
Wed Jul 1 11:03:35 EDT 2009


Hello,

> Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number in
> /appl/wideacc/CustMast/in/OCIpreptest.php on line 23


> Below is the test code I'm running;
> 
> 
> //Connect to the Database
> $dbUser  = 'c1';
> $dbPSWD  = p1';
> $db = 'db1';
> $con = oci_connect($dbUser, $dbPSWD, $db);
> if (!$con) die ('Connect to DB failed');
> //$insSQL = 'INSERT INTO KB_TEST (TESTNAME) VALUES (:TESTNAME)';
> $insSQL = "INSERT INTO KB_TEST  VALUES (:TESTNAME)";
> $insSQL = strtoupper($insSQL); // upper case since ORACLE prefers upper

I'd ditch this...

> and we know we do not have a case issue
> echo "SQL is $insSQL \n";
> $stmt = oci_parse($con, $insSql);
> if (!$stmt) die ('Parse for insert failed');
> 
> //oci_bind_by_name ($stmt, ":TESTNAME", "ERIC");

This one seems as though it should work - are you sure the oci_parse() is
successful and that the first column in that table is really a varchar?

H





More information about the talk mailing list