Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Using sequence for default value, help!!

Using sequence for default value, help!!

From: Chang, Yu-Hua <cyrax_at_ms25.hinet.net>
Date: Thu, 26 Apr 2001 13:38:32 +0800
Message-ID: <9c8c7a$blm@netnews.hinet.net>

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,

                       *

 ERROR ¦b¦æ 2:
ORA-00984: ¤£¥i¦b¦¹¨Ï¥Î¸ê®ÆÄæ Received on Thu Apr 26 2001 - 00:38:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US