1
create table userdetail(
userdetailsid number(3) not null,
userid varchar2(5),
firstname varchar2(15),
lastname varchar2(15),
email varchar2(15),
primary key (userdetailsid)
);
create sequence Iseq
start with 1
increment by 1;
create or replace trigger userDetailInsert
before insert on userdetail
begin
:userdetailsid:=Iseq.nextval;
end;
我得到的錯誤如下:PL SQL觸發器插入值
Error at line 2: PLS-00049: bad bind variable 'USERDETAILSID'
感謝,但我仍然得到另一個錯誤,當我刪除「:」在第2行錯誤:PL/SQL:語句被忽略 1.創建或更換觸發器userDetailInsert 2.插入之前userdetail 3 。begin 4. userdetailsid:= Iseq.nextval; –
好吧,不知道你試圖達到什麼目的,但我想你想用序列值覆蓋所有的'ID'?在這種情況下,你需要爲每一行添加':new.'。看到上面的變化:) – Trinimon