Muhammad Imran Tariq
Muhammad Imran Tariq

Reputation: 23352

AND operator in DB2 constraints

I am trying to add following constraint to my DB2 table but it gives error.

ALTER TABLE Table_name ADD CONSTRAINT VALID_BINDING 
CHECK((LOWER(REQ_BINDING) IN ('http-post','http-redirect'))
AND ((LOWER(RESP_BINDING) IN ('http-post','http-redirect')));

Is this a valid query. Can I use AND operator in it?

Upvotes: 0

Views: 178

Answers (1)

Michał Powaga
Michał Powaga

Reputation: 23183

Isn't it about parentheses?

ALTER TABLE Table_name ADD CONSTRAINT VALID_BINDING 
CHECK(
    LOWER(REQ_BINDING) IN ('http-post','http-redirect') AND 
    LOWER(RESP_BINDING) IN ('http-post','http-redirect')
);

Upvotes: 1

Related Questions