我在创建视图时,用到了union all,结果出现了'未明确定义列'的错误,注意我的所有列名都没有错误,我一共用了3个union all,如果执行任意两个都没有问题,执行3个union all 就出现了上面的问题,不知道大家明白我的意思没有,举例:
create or replace A
as 
select fieldname  from b where sw1
union all
select fieldname  from b where sw2
union all
select fieldname  from b where sw3
union all
select fieldname  from b where sw4如果我任意执行其中的两个union all,一点问题也没有
不知道大家遇到过这样的问题没有,望指点一二!
急,急,急!

解决方案 »

  1.   

    create or replace A
    as 
    这里少了关键字了吧?
    create or replace view a 
    as 
      

  2.   

    create or replace view A
    as
    select fieldname f from b where sw1
    union all
    select fieldname f from b where sw2
    union all
    select fieldname f from b where sw3
    union all
    select fieldname f from b where sw4都加上别名试试
      

  3.   

    试试这样
    create view A
    as 
    select * from (
    select fieldname  from b where sw1
    union all
    select fieldname  from b where sw2
    union all
    select fieldname  from b where sw3
    union all
    select fieldname  from b where sw4
    ) x
      

  4.   

    select fieldname  from b where sw1
    union all
    select fieldname  from b where sw2
    union all
    select fieldname  from b where sw3
    union all
    select fieldname  from b where sw4
    这部分很复杂,我只是简单的写成上面的格式罢了.