0

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

SonalPM
  • 1,317
  • 8
  • 17
user2398621
  • 86
  • 1
  • 3

1 Answers1

1

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

Community
  • 1
  • 1
hatem87
  • 157
  • 4