0

How can i use a comparison operaton in a select i.e.

select 1=2 from dual;

Expecting a boolean result

This request give me an error 00923. 00000 - "FROM keyword not found where expected"

user1753180
  • 87
  • 1
  • 1
  • 7
  • 1
    Does this answer your question? [How to use BOOLEAN type in SELECT statement](https://stackoverflow.com/questions/1465405/how-to-use-boolean-type-in-select-statement) – Abra Dec 16 '20 at 10:48
  • no, I can't add functions nor can I use case – user1753180 Dec 16 '20 at 11:50
  • _I can't add functions nor can I use case_, why? What can you use? And what you expecting as a boolean result - a string 'FALSE' or something else? – 0xdb Dec 16 '20 at 12:48

1 Answers1

2

Yes, you can use the comparison operators but in the clauses where a boolean value is expected, e.g. WHERE, HAVING etc.

An reprodicible example without using the functions and case operator:

select (
    select 'true'  from dual where 1=2 union all
    select 'false' from dual
    order by 1 desc fetch first row only) "boolresult"
from dual
/

boolresult
----------------
false 
0xdb
  • 3,539
  • 1
  • 21
  • 37