为什么这个程序无法运行?它编译正确,但当我尝试插入某些内容时,它会向我显示此错误: ORA-04098:触发'SAMPLEDATA.BI_STUDENTS'无效且无法重新验证。
create or replace PROCEDURE insert_new_student (
pName NVARCHAR2,
pPhone NVARCHAR2,
pReg DATE,
pBirth DATE
)
AS
-- declare variables.
v_student_id NUMBER;
BEGIN
-- add a record.
INSERT INTO STUDENTS (STUDENT_ID, NAME, PHONENUMBER, REGISTRATIONDATE, BIRTHDAY)
VALUES (student_id_seq.nextval, pName, pPhone, pReg, pBirth)
RETURNING STUDENT_ID INTO v_student_id;
END insert_new_student;
//
BEGIN
insert_new_student( 'A', '012345', SYSDATE, '01/26/2017');
END
//
CREATE OR REPLACE EDITIONABLE TRIGGER "BI_STUDENTS"
before insert on "STUDENTS"
for each row
begin
if :NEW."STUDENT_ID" is null then
select "STUDENTS_SEQ".nextval into :NEW."STUDENT_ID" from sys.dual;
end if;
end;
答案 0 :(得分:0)
运行以下内容:
显示错误TRIGGER SAMPLEDATA.BI_STUDENTS;
输出是什么?
运行以下内容:
选择 *
来自user_errors
其中type =' TRIGGER'
和name =' BI_STUDENTS';
结果是什么?