DATES applied SQL Decode function

Asked

Viewed 246 times

3

I have a question I need to make a select where I need to show if a client’s registration is active or not, in the database is treated as follows, has a field date of exit if the field is empty the registration is active now if the registration is filled need to show that it is inactive. To do this SQL how can I use the DECODE function.

2 answers

3


Assuming a DATE field, two solutions

1) DECODE(DATA_SAIDA,NULL,'ATIVO','INATIVO') STATUS

2) (CASE WHEN DATA_SAIDA IS NULL THEN 'ATIVO' ELSE 'INATIVO' END) STATUS

1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.