这可能是一个非常非常基本的问题,但我是 Oracle 的初学者。我正在运行一个简单的查询,它工作正常并返回结果,但是当将 *
添加到显示的列列表时,我收到以下错误:
ORA-00936: missing expression
00936. 00000 - "missing expression"
*Cause:
*Action:
Error at Line: 4 Column: 7
我正在运行的查询是:
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;
我认为这是因为我没有为我的前两列提供别名,所以我这样做了,但查询仍然无法正常工作。
最佳答案
您不能将原始 *
与其他列混合使用。您需要使用适当的别名:
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;
关于oracle - 为什么在向查询添加 * 时出现错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32881765/