This is probably a very very basic issue but I'm a beginner with Oracle. I'm running a simple query, which works fine and returns results, but when adding a * to the list of columns displayed, I get the below error:
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
Error at Line: 4 Column: 7
The query I'm running is:
select
sql_plan_hash_value col1
, elapsed_seconds col2
, *
from
(select *
from SYS.V_$SESSION_LONGOPS
order by elapsed_seconds desc) result_set
where rownum <= 10;
I thought that it's because I'm not giving aliases to my first two columns, so I did, but the query is still not working.
You can't mix raw * with other columns. You need to use the appropriate alias:
select
sql_plan_hash_value col1
, elapsed_seconds col2
, result_set.* --> Like this
from
(select *
from SYS.V_$SESSION_LONGOPS
order by elapsed_seconds desc) result_set
where rownum <= 10;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With