Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top