i am trying this on apex.oracle.com
i followed the topic on stackoverflow:
https://stackoverflow.com/questions/49749775/ora-02438-column-check-constraint-cannot-reference-other-columns
i tried to create a table as below to test this constraint:
create table temp_loan (
id number,
emp_id number not null,
date_from date not null,
date_to date not null,
loan_amount number,
loan_status varchar2(1) default 'A' check(loan_status in ('Y', 'N')),
remarks varchar2(200),
constraint check (date_from <= date_to)
);
but it is throwing error: ORA-02438: Column check constraint cannot reference other columns.
in above link, they showed that the table with constraint (table level) has been created, but mine is showing error.
is anything i am doing wrong or missing something or i mis-understood it completely?
during my search, some people showed that you can do it in a trigger, it is ok.
please help.
regards