問題
1、建立序列
create sequence t1id_seq
minvalue 1
maxvalue 999999
start with 1
increment by 1
cache 20
;
select t1id_seq.nextval from dual;
2、建立觸發器
create or replace trigger t1id_tr
before insert on t_cms_article for each row
begin
select to_char(t1id_seq.nextval) into :new.id from dual;
end t1id_tr;
//insert 時 有new,update 有old,new ,delete 有old
3、執行insert into t_cms_article...select from 時
ora-04098: 觸發器無效且未通過重新驗證
解決辦法:
建立觸發器有誤,雖然開始成功執行了。
create or replace trigger t1id_tr
before insert on t_cms_article for each row
begin
select to_char(t1id_seq.nextval) into :new.id_ from dual;
end t1id_tr;
t_cms_article 對應
insert 的表 , :new.id_ 其中id_為 t_cms_article的乙個列
ORA 04098 觸發器 無效且未通過重新確認
執行 create or replace trigger machinetypes trigger before insert on ws2 rp machinetypes for each row begin select machinetypes sequence.nextval into ne...
ORA 04098 觸發器無效且未通過重新驗證
oracle 菜鳥,犯了乙個低階錯誤,用powerdesigner的sql preview建立表的時候沒有建立sequence 導致新增資料報此錯誤,折騰半天才反應過來!於是開啟powerdesigner,找到主鍵一列 屬性 sequence 屬性 preview,複製語句貼上到oracle中執行,...
ORA 04091 觸發器寫錯了
今天同事來說,我寫的觸發器出問題了。我看了錯誤 ora 04091。以前沒寫過,然後通過各種途徑學了一下,就寫了如下觸發器 create or replace trigger trigger a after insert on table a for each row begin insert in...