我有这样的oracle语法:
select 'Tanggal : '||to_char(c,'DD-MON-YYYY hh:mm:ss')||',' as Tgl,
case
when (select ((a.sk/b.tot)*100)
from (select count(to_char(response))sk
from log where response like '%OK%')a,
(select count(*)tot from log)b)<100
then (select 'Error : '||to_char(response),count(to_char(response)) je
from log
group by to_char(response)
order by je desc)
else
(select 'Success Rate : '||substr((a.sukses/b.total)*100,1,5)||' %,'as Success_rate
from (select count(to_char(response)) sukses from log where response like '%OK%')a, (select count(*) total from log)b)
end as test
from log
where rownum <= 1;
但它发送错误消息ORA-00907: missing right parenthesis,
它指的是由#desc&#34;命令。
那么,我该怎么做才没有错误?
答案 0 :(得分:0)
你的查询真的很难看,有很多事情要做,以改善它,但只是看看你的代码中的奇怪的东西,有2个错误的语法
select ((a.sk/b.tot)*100)
from (select count(to_char(response))sk
from log where response like '%OK%')a,
(select count(*)tot from log)b)<100
你所拥有的部分
)a,
(select
....这是不可能的。
这就像(a,b)&lt; 100,没有任何意义
然后order by
也错了。只需删除它。再试一次