I'm trying to add a calculated yes/no field to a working query using the the EXISTS operator in a DECODE function.
I want to run a sub-query to see if the order exists in another table, and if it does, then I want to flag it as "Special".
I'm getting a message that says ORA-00936: missing expression.
My SQL looks something like this:
select order_id,
username,
complete_date,
decode(exists(select field1
from table2
where order_id=table1.order_id), true, 'Y', 'N') SPECIAL
from table1
where complete_date is not null
What am I doing wrong? _________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
I want to run a sub-query to see if the order exists in another table, and if it does, then I want to flag it as "Special".
I'm getting a message that says ORA-00936: missing expression.
My SQL looks something like this:
select order_id,
username,
complete_date,
decode(exists(select field1
from table2
where order_id=table1.order_id), true, 'Y', 'N') SPECIAL
from table1
where complete_date is not null
What am I doing wrong? _________
Rott Paws
...It's not a bug. It's an undocumented feature!!!