'Date or system variable wrongly specified in check constraint [duplicate]
Alter table tblstaff modify jdate date check ( jdate < sysdate );
I have error that
ORA-02436: date or system variable wrongly specified in check constraint
Solution 1:[1]
As commented, check constraint won't work but trigger would. Here's an example, adjust it as you wish.
create or replace trigger trg_staff_date
before insert or update on tblstaff
for each row
begin
if :new.jdate < sysdate then
raise_application_error(-20000, 'You can not insert future dates');
end if;
end;
/
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Littlefoot |
