Reputation: 13610
I'm building a complex SQL query and I want to test a result in a while statement.
I want to do something like:
WHERE ( R.Expired IS NULL OR R.Expired > SYSDATE )
AND (
CASE
WHEN R.Description LIKE '%SSX%' THEN TRUE
ELSE FALSE
END
) ORDER BY R.Name
But PL/SQL says it has some "invalid relational operator" (translated).
Is there something wrong with my CASE statement?
Upvotes: 1
Views: 65
Reputation: 6390
The CASE WHEN
stuff looks unnecessary to me.
Just use
AND (R.Description Like '%SSX')
First rule of debugging - avoid unnecessary complexities.
Upvotes: 4
Reputation: 52376
Simple:
WHERE (R.Expired IS NULL OR R.Expired > SYSDATE) AND
R.Description LIKE '%SSX%'
Upvotes: 1
Reputation: 736
Not sure what you're trying to achieve here, but you can perhaps try enclosing TRUE and FALSE in single quotes (as booleans are not supported in SQL) or simply write something like AND R.Description LIKE '%SSX%'
.
Upvotes: 1