我有这样定义的表:
create table "nakup" (
"cislo_n" INTEGER not null,
"id_zak" INTEGER not null,
"jm_pobocky" CHAR(15) not null,
"datum_cas" DATE not null
constraint CKC_DATUM_CAS_NAKUP check ("datum_cas" >= TO_DATE('1.01.1994 8:30:25', 'DD.MM.YYYY HH24:MI:SS')),
constraint PK_NAKUP primary key ("cislo_n")
我想创建一个触发器来阻止插入未来的日期,我的代码如下所示:
create or replace TRIGGER TRIGGER1
BEFORE INSERT OR UPDATE ON "nakup"
FOR EACH ROW
BEGIN
if (:new.datum_cas > current_timestamp) then
raise_application_error(-20000, 'Špatně zadané datum a čas.');
end if;
END;
我不断收到错误 Error(5,7): PLS-00049: chybná vázaná proměnná 'NEW.DATUM_CAS' (英语中的错误绑定变量)。我究竟做错了什么?