如何为oracle中的表增加像sqlserver一样的自动列
conn scott/tiger@powermis
drop table foo;
create table foo(
id number primary key,
data varchar2(100));
create sequence foo_seq;
create or replace trigger bifer_foo_id_pk
before insert
on foo
for each row
begin
select foo_seq.nextval into :new.id from dual;
end;
/
insert into foo(data)
values('Chirstopher');
insert into foo(id,data)
values(5,'Sean');
select * from foo;
原文转自:http://www.ltesting.net
|