如何解决执行触发器以自动递增字段时出错
我正在尝试执行用于自动递增字段的触发器。 表,序列和触发器的脚本已成功编译并执行。但是,当我尝试插入记录时,出现以下错误:
SQL Error: ORA-04098: trigger 'CAR_ON_INSERT' is invalid and failed re-validation
04098. 00000 - "trigger '%s.%s' is invalid and failed re-validation"
*Cause: A trigger was attempted to be retrieved for execution and was
found to be invalid. This also means that compilation/authorization
failed for the trigger.
*Action: Options are to resolve the compilation/authorization errors,disable the trigger,or drop the trigger.
下面是数据库脚本:
CREATE TABLE CAR(
CAR_ID NUMBER NOT NULL,CAR_NAME VARCHAR2(40) NOT NULL
);
CREATE SEQUENCE CAR_id_seq INCREMENT BY 1 START WITH 1;
CREATE OR REPLACE TRIGGER CAR_on_insert
BEFORE INSERT ON CAR
FOR EACH ROW
BEGIN
SELECT CAR_id_seq.nextval
INTO :new.CAR_ID
FROM dual;
END;
我没有得到什么问题。
谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。