Re: Default sequence number
From: Alf-Kenneth Aabel <alf-ka_at_online.no>
Date: 1996/10/29
Message-ID: <554dos$hoi_at_o.online.no>#1/1
Date: 1996/10/29
Message-ID: <554dos$hoi_at_o.online.no>#1/1
With this trigger I can insert into company. Primary key in company is company.
- Trigger for company CREATE OR REPLACE TRIGGER tibr_company BEFORE INSERT ON company FOR EACH ROW DECLARE nVal company.company%TYPE; BEGIN SELECT seq_company.NEXTVAL INTO nVal FROM DUAL; :new.company := nVal; END; /
lesliet_at_u.washington.edu (L. Tseng) wrote:
>But, even with the trigger, it still requires to specify the column list
>when doing the insert.
> INSERT INTO tablename VALUES (val2,val3,val4) won't work when
> tablename has (col1,col2,col3,col4) and col1 is the ID column.
>Do you know why Oracle can't use NEXTVAL as default
>when creating a table?
> CREATE TABLE tablename (
> ID number DEFAULT seq_num.NEXTVAL)
Received on Tue Oct 29 1996 - 00:00:00 CET