Re: [Fwd: [PHP-GENERAL] MySQL <-> Oracle8]

From: Date: Mon, 05 Jun 2000 17:47:33 +0000
Subject: Re: [Fwd: [PHP-GENERAL] MySQL <-> Oracle8]
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-213@lists.php.net to get a copy of this message
> > I need to get the ID generated from a previous INSERT operation. > > Is there an equivalent PHP/Oracle8 function for 'mysql_insert_id()' > using MySQL? > If not, how can I make a simple workaround? > Oracle doesn't have "autoincrement" columns. Use sequences instead., e.g.: INSERT into mytable Values(myseq.nextval, ...); Check if insert was successful; SELECT myseq.CURVAL from DUAL; This will give you the value back. But you have to check if the insert was successful, the sequence is incremented anyway. Or you could wrap the insert operation into a PL/SQL Procedure / Function that returns the current value for your sequence -Andreas

« previous php.db (#213) next »