Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQL return text based on CASE WHEN...

StylesNov 13 2018 — edited Nov 13 2018

Greetings,

Using APEX 5.1

New with SQL statements, Trying to have a column for messages to see when a card is expired based on a date comparison

Basically, is the system date is GREATER than the access card expiry date (access_card_exp_date) + 30 days then message in a column (virtual) - message states "Expired"

OR when system date is LESS than the access card expiry date (access_card_exp_date) + 30 days then message in a column (virtual) - message states "OK"

Else no message

Here is my attempt. Maybe a CASE statement isn't even the way to go...

   CASE access_card_exp_date WHEN (SYSDATE > access_card_exp_date + 30) THEN 'Expired'

   WHEN (SYSDATE < access_card_exp_date + 30) THEN 'OK'

   ELSE Null as message

   END

Thanks,

K

Comments
Post Details
Added on Nov 13 2018
11 comments
2,196 views