Reputation: 86
I have an alphanumeric expression which I like to evaluate to true/false. For example ('A' = 'B' or 10 > 5) should return true. I am working with DB2 for i, so a standard sql would be required. I tried
Select ('A' = 'B' or 10 > 5) from sysibm/sysdummy1
and
Select (('A' = 'B' or 10 > 5) = '1') from sysibm/sysdummy1
but the error says in the first case Token '(' required and in the second case Token '=' invalid. How would you do this? Thanks
Upvotes: 0
Views: 96
Reputation: 370
Try like this please:
select case when 'A' ='B' or 10 > 5 then 1 else 0 end
Also maybe this post can help Boolean Expressions in SQL Select list
Upvotes: 1