我想让Oracle数据库中的一个“产品表”的一个编号字段自动增长,
所以我先建了一个序列 seq_production_id
然后我在建触发器时出现了错误,触发器的SQL语句如下:
CREATE OR REPLACE TRIGGER "SYSTEM"."TRI_PRODUCTTION_ID" BEFORE
INSERT ON "SYSTEM"."PRODUCTION" FOR EACH ROW
begin
select seq_production_id.nextval into :new.id form dual;
end;Oracle数据库报的错误为:
SQL 错误
Failed to commit: ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-320: 此表达式的类型声明不完整或格式不正确
我实在是看不出错误在哪里,跪求大侠帮忙解决
所以我先建了一个序列 seq_production_id
然后我在建触发器时出现了错误,触发器的SQL语句如下:
CREATE OR REPLACE TRIGGER "SYSTEM"."TRI_PRODUCTTION_ID" BEFORE
INSERT ON "SYSTEM"."PRODUCTION" FOR EACH ROW
begin
select seq_production_id.nextval into :new.id form dual;
end;Oracle数据库报的错误为:
SQL 错误
Failed to commit: ORA-06552: PL/SQL: Compilation unit analysis terminated ORA-06553: PLS-320: 此表达式的类型声明不完整或格式不正确
我实在是看不出错误在哪里,跪求大侠帮忙解决
create table book(
bookId varchar2(4) primary key,
name varchar2(20)
);
--创建序列
create sequence book_seq start with 1 increment by 1;
--创建触发器
create or replace trigger book_trigger
before insert on book
for each row
begin
select book_seq.nextval into :new.bookId from dual;
end ;
--添加数据
insert into book(name) values ('cc');
insert into book(name) values ('dd');
SELECT * FROM BOOK