Re: oracle last inserted

From: Date: Mon, 26 Mar 2001 06:55:05 +0000
Subject: Re: oracle last inserted
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-45583@lists.php.net to get a copy of this message
On Mon, Mar 26, 2001 at 10:19:28AM +0800, Chien-pin Wang wrote: > > If you use sequence to generate your last_inserted_id, then you can always > get that ID by calling > > SELECT sequence_name.CURRVAL > FROM DUAL; > > within the same session. <?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 > > Chien-pin > > On Sun, 25 Mar 2001, almir wrote: > > > is there a way to get last inserted id from oracle as > > mysql_inerted_id() or > > SELECT @@IDENTITY AS LastId > > in mssql server > > > > i have a function that does only that, takes insert statement and returns > > last id, but this function have to work for all tables (different triggers > > in oracle) , right now the only thing i can imagine is to give this function > > the name of ID column and read name of table with regex and then do > > select max(parametar_id) from regex_table > > and then to do commit , > > this way is somehow realy stupid but is my only solution in this moment so > > if you have any better ideas plese help > > > > almir > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#45583) next »