当我使用PowerDesigner生成SQL并在Oracle中运行它时,它会抛出错误
警告:使用编译错误创建触发器
create trigger "tib_material_classify" before insert
on "material_classify" for each row
declare
integrity_error exception;
errno integer;
errmsg char(200);
dummy integer;
found boolean;
begin
-- column ""id"" uses sequence material_classify_seq;
select material_classify_seq.nextval into :new."id" from dual;
-- errors handling
exception
when integrity_error then
raise_application_error(errno, errmsg);
end;
当我在Oracle中发布show errors
时,它会说:
10/5 PL / SQL:忽略SQL语句 10/12 PL / SQL:ORA-02289:序列不存在
我做错了什么?
答案 0 :(得分:1)
错误消息表明缺少序列material_classify_seq
。您可以使用以下SQL语句创建缺少的序列:
Create Sequence material_classify_seq;
答案 1 :(得分:0)
在创建触发器之前,您需要创建sequnce
创建触发器后Create sequence material_classify_seq start with 1;