Re: ocibindbyname: ORA-01008: not all variables bound

From: Date: Thu, 05 Apr 2001 16:51:49 +0000
Subject: Re: ocibindbyname: ORA-01008: not all variables bound
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-8280@lists.php.net to get a copy of this message
On Thu, Apr 05, 2001 at 12:47:37PM -0400, Joe Brown wrote: > Don't have a whole lot of practice with the OCIBindByName function, but I > seem to be having success within a recursive select statement. > > I'm not useing the & operator in my implementation. Don't know if that's a > good or a bad thing (yet), but it seems to be functioning properly. > > The third parameter you have -1. I think you want to set it to a legitimate > max field length value. -1 is used for LOBs, ROWID and FILENAME parameters, > not run of the mill number and varchar2 fields. > > perhaps: > OCIBindByName($parsed,":id",$id,32); //may work better? this is a working sample: <?php $data = array("larry","bill","steve"); $db = OCILogon("scott","tiger"); $stmt = OCIParse($db,"insert into names values (myid.nextval,:name) returning id into :id"); OCIBindByName($stmt,":ID",$id,32); OCIBindByName($stmt,":NAME",$name,32); while (list(,$name) = each($data)) { OCIExecute($stmt); echo "$name got id:$id\n"; } ?> re, tc > > ""Paul Fernandez"" <dude@dude.com> wrote in message > news:9ai699$n70$1@toye.p.sourceforge.net... > > Hello, > > > > The goal here is to insert a single row, then get a numerical value "id" > > (generated by the insert trigger) to use in another insert statement. > > > > I get, "ORA-01008: not all variables bound" when running this script: > > > > <? > > $query = "insert into table (col1, col2) values ($val1,$val2) returning id > > into :id"; > > $parsed = OCIParse($connection,$query); > > > > OCIBindByName($parsed,":id",&$id,-1); > > > > // execute first insert > > $cursor = OCIExecute($parsed); > > > > // construct and execute 2nd insert > > $query2="insert into table2(id,etc) values (:id, $etc)"; > > $parsed2 = OCIParse($connection,$query2); > > $cursor2 = OCIExecute($parsed2); > > ?> > > > > It seems so simple. What am I doing wrong? > > > > Paul Fernandez > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: php-db-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#8280) next »