+ -
当前位置:首页 → 问答吧 → 相同语句创建的表与视图,对其中的同一个字段做全表sum的结果不一致,怎么入手解释这个现象?

相同语句创建的表与视图,对其中的同一个字段做全表sum的结果不一致,怎么入手解释这个现象?

时间:2011-12-14

来源:互联网

本人安装的是oracle11gR2;

创建表(create table as方式)与视图的语句:
  select t1.start_dt,t1.user_name,
  t1.login_type,t1.ua_type,
  t2.start_time,t2.node_id,t2.nas_ip,t2.roam_domain,
  t2.session_time,t2.input_octets,t2.output_octets
  from 
  (select a.start_dt,a.user_name,a.nas_ip,a.login_type,a.ua_type,
  row_number() over(partition by user_name order by start_dt asc) r_num 
  from temp_monitor_ua_1128 a) t1,
  (select b.start_time,b.user_name,b.node_id,
  b.nas_ip,b.roam_domain,b.session_time,
  b.input_octets,b.output_octets,
  row_number() over(partition by user_name order by start_time) r_num 
  from temp_usage_bppp_1128 b) t2
  where t1.user_name=t2.user_name
  and t1.r_num=t2.r_num;

做sum的语句:
select sum(a.session_time) from temp_table a
union all
select sum(a.session_time) from view_table a;
结果:
1 5087185135
2 5087196832

如何解释这个现象。。。。。。?

表空间是由3个数据文件组成的,10g,10g,5g,不知与这个有关系否?

作者: zhuxu1234   发布时间: 2011-12-14

you should write the create statements on pages too..

作者: haohaixingyun   发布时间: 2011-12-14

热门下载

更多