oracle 自動列值增加

maojinyu發表於2011-05-25
Normal 0 7.8 pt 0 2 false false false MicrosoftInternetExplorer4

1 Sequence:

Create sequence

2 Trigger:

create or replace trigger a_t

before insert on a

for each row

declare

-- local variables here

begin

select a_se.nextval into :new.id from dual;

end a_t;

3 Insert data into table:

insert into a(name) values('dd')

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9907339/viewspace-1050348/,如需轉載,請註明出處,否則將追究法律責任。

相關文章