How can I build this select in Oracle:
SELECT DATETYPE_FIELD, DATETYPE_FIELD < SYSDATE AS IS_ON_DATE FROM MYTABLE
DATETYPE_FIELD
is a DATE
field. I want to get something like TRUE/FALSE
in calculated IS_ON_DATE
field. USING that select still get an error in ORACLE.
How can this be done?
There is no boolean type in Oracle. You can use 1 or 0 to denote true or false like this:
select DATETYPE_FIELD,
case
when DATETYPE_FIELD < SYSDATE
then 1
else 0
end as IS_ON_DATE
from MYTABLE
or string "true" and "false"
select DATETYPE_FIELD,
case
when DATETYPE_FIELD < SYSDATE
then 'true'
else 'false'
end as IS_ON_DATE
from MYTABLE
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.