RE: [PHP] Oracle question
| From: | Chadwick, Russell | Date: | Tue, 10 Jul 2001 16:21:21 +0000 |
| Subject: | RE: [PHP] Oracle question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-57194@lists.php.net to get a copy of this message | ||
Create a sequence, like so
CREATE SEQUENCE "WHATEVER_IDS"
INCREMENT BY 1
START WITH 1
MAXVALUE 1.0E28
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER;
then when you insert
INSERT INTO test (whatever_ids.nextval);
the nice thing is that in your next query you can just do
whatever_ids.curval
instead of looking up the value with mysql_auto_id or whatever the function
is.
-----Original Message-----
From: Duy B [mailto:ngo_duy@fmail.vnn.vn]
Sent: Monday, July 09, 2001 7:36 PM
To: php-general@lists.php.net
Subject: [PHP] Oracle question
Dear all,
If i want to use id field in Oracle database, how can i do?
For example, in MySQL
create table test (
id int not null auto-increment primary key,
ten char(10));
So that, when i insert a new row into MySQL database, id increases by 1.
But in Oracle i couldn't use as that.
Somebody could help me.
Thanks you all,
BaoDuy