문제

I would like to know what is the different between 'in' clause and 'like' clause oracle in check constraint.

here is sample code for 'in' clause

ALTER TABLE EXPREPORT
ADD CONSTRAINT EXPREPORT_CHK1 CHECK 
(EXPREPSTATUS IN ('PENDING', 'APPROVED', 'DENIED'))
ENABLE;

here is sample code for 'like' clause

ALTER TABLE EXPENSEREPORT
ADD CONSTRAINT EXPENSEREPORT_CHK1 CHECK 
(EXPREPSTATUS LIKE 'APPROVED' OR EXPREPSTATUS LIKE 'DENIED' OR EXPREPSTATUS LIKE 'PENDING')
ENABLE;

is there any difference between these two clause?

도움이 되었습니까?

해결책

LIKE column value is similar to specified character(s).

IN column value is equal to any one of a specified set of values.

Click Here for more information about LIKE and IN clause.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top