Reputation: 137
I need some help with case statement. my code:
select c.name, c.date_entered, i.transaction, i.planned_date,
case (c.date_entered - i.planned_date)
when (c.date_entered - i.planned_date) > 0 then 'YES'
when (c.date_entered - i.planned_date) < 0 then 'NO'
end RESPECT
from company c,transaction i
but it give me error ORA-00907; missing right parenthesis
thank you to help me with.
Upvotes: 1
Views: 99
Reputation: 204784
select c.name, c.date_entered, i.transaction, i.planned_date,
case when c.date_entered - i.planned_date > 0
then 'YES'
when c.date_entered - i.planned_date < 0
then 'NO'
end as RESPECT
from company c, transaction i
You should also think about the output of when c.date_entered - i.planned_date = 0
or change one of the cases to <=
or >=
.
Upvotes: 2