Hi,
>We need to autoincrement VISITORID when we inserts something in the VISITOR
>table and we use SEQUENCE
>
>drop sequence VISITORID_seq;
>create sequence VISITORID_seq start with 1;
>
>
>-------------------------------------
>create table VISITOR (
> VISITORID number DEFAULT VISITORID_seq.nextval UNIQUE,
???????????? ERROR!!
> LOGINID varchar2 (32) NOT NULL UNIQUE,
> PASSWORD_VALUE varchar2 (32),
> CONFIRM_VALUE varchar2 (32),
> FIRST_NAME varchar2 (99) NOT NULL,
> LAST_NAME varchar2 (99) NOT NULL,
> ADDRESS1 varchar2 (255),
>
>Someone knows how to do this?
>
The normal way that you do this in Oracle is
insert into Visitor
(VISITORID,
LOGINID,
...)
values
(VISITORID_seq.nextval,
401,
...);
>What about to create a trigger to insert VISITORID_seq.nextval into
VISITORID?
Of course, a trigger would also work, and it would work
more like the MySQL AUTO_INCREMENT option, for which
Oracle has no counterpart.
So to make this work for Oracle, either
a) a trigger should be written and included in the SQL
source for Oracle
b) the code needs to be aware that some databases (Oracle)
can't autogenerate the Primary Key and it needs to be
included in the insert list
Stephen
P.S. You could also use the IDBroker instead of an Oracle
sequence.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]