在Oracle Apex中使用Pivot显示空值和n的奇怪结果

时间:2014-10-27 13:37:16

标签: oracle oracle11g pivot oracle-apex

我用Apex 4.2.6运行oracle 11g。我试图运行一个脚本,但在顶点返回空值但在SQL开发人员中显示正确的结果

  select "ENG_ID","ENG_ID1","roles","Region","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15"    ,"16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31" from (
   select M.ENG_ID as ENG_ID,
M.ENG_ID as ENG_ID1,
e.ROLE_ID as "roles",
  e.REGION_AREA_ID as "Region",
EXTRACT(DAY FROM M.MS_DATE) as DOM,
   MD.MD_ID 
      --MD.JOB_TYPE_ID
from MD_TS_DETAIL MD,
MD_TS_MAST M,MAN_ENGINEERS e
where
m.eng_id = 542 and
M.ENG_ID = e.ENG_ID and
M.MAST_ID=MD.MD_ID and
M.MS_DATE between trunc(sysdate,'MM') and last_day(sysdate)
)pivot (
max(MD_ID) 
for DOM in (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31)
)

给了我

的正确结果

SQL Dev视图

然而,在Apex中运行相同的脚本会得到空值。

顶点视图。

我完全难过你们有什么想法

1 个答案:

答案 0 :(得分:0)

确定两者都记录在APEX和数据库之间的最大记录是什么。 。在SQL workshop>选择的MD_TS_MAST>统计数据>分析>估计统计变化为100%>下一个>完成。

所有记录都回来了。为什么顶点没有直接从数据库运行我不知道。所以基本上如果在SQL开发人员中进行插入,你必须通过analyze进行更新。