Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Using sequence for default value, help!!
Hi,
I want to have a serial number to be the primary key in a table.
I create a sequence successfully,
but when I use it while creating table, it raise ORA-00984 error.
My Oracle server infomation is:
Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.0.0 - Production
Can anyone tell me what's wrong with my SQL code:
SQL> create sequence id_test_id
2 minvalue 1
3 maxvalue 999
4 increment by 1
5 start with 1
6 nocycle
7 nocache
8 noorder;
§Ç¦C¤w³Q«Ø¥ß
SQL> create table id_test(
2 id number(3) default id_test_id.nextval,
3 tday date default sysdate,
4 constraint id_test_pk primary key (id)
5 );
id number(3) default id_test_id.nextval,
*