1. exists:
select * from table1 where exists (select * from table2)2. sequence
3.
create sequence CustomerID increment by 1 start with 1000;
insert into Customer (name, id)
values ('whatever',CustomerID.NextVal);
select * from table1 where exists (select * from table2)2. sequence
3.
create sequence CustomerID increment by 1 start with 1000;
insert into Customer (name, id)
values ('whatever',CustomerID.NextVal);
原来我第一个问题是exists少写了个“s”。这样自动加一,好像太麻烦了。我想的是
insert into Customer(name)
values('whatever');
时,对应的id自动加一。
用触发器不知道可不可以呢?
Begin
:new.id := 序列号;
End;