Sql 为什么我的代码有错误00049坏绑定变量
只需要能够插入一天的记录。任何其他记录都必须等到第二天 在New.DateLimit有PLS 00049错误Sql 为什么我的代码有错误00049坏绑定变量,sql,oracle,plsql,triggers,unique-constraint,Sql,Oracle,Plsql,Triggers,Unique Constraint,只需要能够插入一天的记录。任何其他记录都必须等到第二天 在New.DateLimit有PLS 00049错误 可能列名不是DateLimit,而是Date_Limit。可能列名不是DateLimit,而是Date_Limit。如果我没有弄错,您希望按照列Date_Limit的定义,每天只允许一条记录 你不需要扳机。一个选项使用计算列和唯一约束 create or replace trigger addDate before insert or update on Employee for ea
可能列名不是DateLimit,而是Date_Limit。可能列名不是DateLimit,而是Date_Limit。如果我没有弄错,您希望按照列
Date_Limit
的定义,每天只允许一条记录
你不需要扳机。一个选项使用计算列和唯一约束
create or replace trigger addDate
before insert or update on Employee
for each row
begin
for EmployeeRec in
(
select * from employee
)
loop
if (EmployeeRec.DateLimit > sysdate) then
raise_application_error (-20001, 'You are only allowed to insert once a day, please try again
tomorrow');
end if;
end loop EmployeeRec;
:NEW.DateLimit := sysdate + 1;
end;
/
show errors;
day\u limit
是一个计算列,其中包含date\u limit
的日期部分(时间部分已删除)。此列上设置了unique
约束,因此两行不能具有属于同一天的date\u limit
s
如果我正确地跟踪了您,您希望每天只允许一条记录,如列
date\u limit
所定义
你不需要扳机。一个选项使用计算列和唯一约束
create or replace trigger addDate
before insert or update on Employee
for each row
begin
for EmployeeRec in
(
select * from employee
)
loop
if (EmployeeRec.DateLimit > sysdate) then
raise_application_error (-20001, 'You are only allowed to insert once a day, please try again
tomorrow');
end if;
end loop EmployeeRec;
:NEW.DateLimit := sysdate + 1;
end;
/
show errors;
day\u limit
是一个计算列,其中包含date\u limit
的日期部分(时间部分已删除)。此列上设置了unique
约束,因此两行不能具有属于同一天的date\u limit
s
如果您需要oner员工每天有一条记录,那么您可以有一个唯一的约束条件和一个日期更新/插入列,并检查该记录?如果一名员工一天收到10行,那么插入该行的过程是什么?如果一名员工每天需要一条记录,那么您可以有一个唯一的约束和一个日期更新/插入列,并进行检查?如果您一天收到一个员工的10行,那么插入它的过程是什么?问题就在这里!任务说明创建一个触发器,这就是问题所在!分配状态为创建触发器哈哈哈