質問

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