【发布时间】:2018-11-26 13:33:42
【问题描述】:
我在下面创建了一个触发器(Trig 1),以便在插入员工表之前触发。然后此触发器将调用过程 (Proc 1),该过程将验证出生日期不早于当前日期。如果不继续插入,但如果日期早于当前日期,它将显示一条消息,如“无效的生日”。 (触发 1)
create or replace trigger VALIDATE_BDAY_TRIG
before insert on employee
for each row
declare
birth_date date;
employee_birthdate date;
begin
birth_date := employee_birthdate;
val_bday_proc birth_date;
end VALIDATE_BDAY_TRIG;
(过程 1)
create or replace procedure val_bday_proc(
date_of_birth in date)
as
begin
if date_of_birth > current_date()
then raise_application_error(-20000, 'Employee birth date should not be earlier than the current date');
end;
【问题讨论】:
-
在编译上面的触发器时,我得到了这个错误:错误(9,23):PLS-00103:在期待以下之一时遇到符号“BIRTH_DATE”::=。 ( @ % ; 符号 ":=" 被替换为 "BIRTH_DATE" 以继续。
-
我也不确定我的程序是否可行。
-
请将问题放在问题中,而不是在 cmets..(点击“编辑”以编辑问题)。
-
对不起,我的错。只是一个新成员。
标签: sql oracle plsql database-trigger