通过微软的报表服务器访问oracle,做好一张报表,为了偷懒,直接在数据库建立了一个视图,然后显示就行了。结果测试时报ora-600 [qks3tinit]。登陆到本机一运行,没问题啊。怀疑是微软报表服务器连接oracle的接口有问题。但是其他几个类似视图又都没问题。于是检测sql:
select (case
when fjname is null
then '全局'
else fjname
end) fjname,
(case
when stat_type is null
then '总计'
else stat_type
end) stat_type,
(case
when cust_type_old is null
then '总计'
else cust_type_old
end
) cust_type_old,
cnt, curr_user
from (select fjname, stat_type, cust_type_old, count (*) cnt, sum(case state when '正常' then 1 else 0 end) curr_user
from tmp_tj0507001
where fjname is not null
group by grouping sets(rollup(fjname, stat_type, cust_type_old), rollup(stat_type, cust_type_old)))
order by fjname, stat_type, cust_type_old;
执行计划:
select statement, goal = hint: all_rows cost=10 cardinality=15 bytes=780
sort order by cost=10 cardinality=15 bytes=780
view object owner=yaoyp cost=8 cardinality=15 bytes=780
temp table transformation
view object owner=yaoyp cost=8 cardinality=4 bytes=208
view object owner=yaoyp cost=8 cardinality=4 bytes=208
union-all
table access full object owner=sys object name=sys_temp_0fd9d668f_9a864b59 cost=2 cardinality=1 bytes=52
table access full object owner=sys object name=sys_temp_0fd9d6690_9a864b59 cost=2 cardinality=1 bytes=52
table access full object owner=sys object name=sys_temp_0fd9d6691_9a864b59 cost=2 cardinality=1 bytes=52
table access full object owner=sys object name=sys_temp_0fd9d6691_9a864b59 cost=2 cardinality=1 bytes=52
recursive execution object name=sys_le_7_0
recursive execution object name=sys_le_7_1
recursive execution object name=sys_le_7_2
recursive execution object name=sys_le_7_3
就看到一个temp table transformation,这个比较少见哦。另外一个类似sql: