我创建了一个视图a,然后执行如下语句会报错
  select * from a
  union all
  select * from a
  union all
  select * from a
  union all
  select * from a
  报未定义列错误.
如果执行
  select * from a
  union all
  select * from a
  union all
  select * from a
就不会报错.
三个union all就报错
两个就不报错
请问是什么原因?

解决方案 »

  1.   

    你的oracle什么版本,9i下没出现你说的情况:
    SQL>   CREATE VIEW v_test AS
      2    select * from a
      3    union all
      4    select * from a
      5    union all
      6    select * from a
      7    union all
      8    select * from a
      9    union all
     10    select * from a
     11  /View createdSQL> select count(*) from v_test;  COUNT(*)
    ----------
            40
      

  2.   

    9i的,也不是每个视图都会出错,就这一个视图,一用union all就出错,郁闷啊!