Oracle 触发器错误无效且未通过验证

创建表
CREATE TABLE Vehicle_Info(
Vehicle_Code int NOT NULL,
Dept_Code varchar(50) NOT NULL,
License_Plate varchar(10) NOT NULL,
Dept_Type varchar(50) NOT NULL,
Dept_load varchar(50),
Manufactor varchar2(50),
Status varchar2(50),
Alarm_Info varchar2(100),
Vehicle_Type varchar2(50),
CRT_DT date,
CRT_USR varchar2(10),
MDY_DT date,
MDY_USR varchar2(10)
)
创建序列
Create sequence VEHICLE_CODE
Increment by 1
Start with 1
Maxvalue 999999
Minvalue 1
Nocycle
nocache;
创建触发器
CREATE OR REPLACE TRIGGER VEHICLE_TRI
AFTER INSERT ON Vehicle_Info
FOR EACH ROW
BEGIN
END VEHICLE_TRI;
测试INSERT INTO VEHICLE_INFO (DEPT_CODE,LICENSE_PLATE,DEPT_TYPE)
VALUES('1','1','1')

这个试试:
CREATE OR REPLACE TRIGGER userid_trigger
BEFORE
INSERT
ON users
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
SELECT test_sequence.nextval INTO :new.userid FROM dual;
end;
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答