create or replace view V_$Workers as
  select rnum,oper,opername,opdate,rname,rclass,rdclass,rera.raccname,rgrade,rresource,rrefnum,rwarehouserwound,workid,taskname,imgpath,werifyrecord,werifyperson,werifydate,snumber,jjudger,jdate,jrem,jopinion from(
         select rnum,rclass,rgrade,rresource,rrefnum,rfillope as oper,rfillopename as opername,rfilldate as opdate
         from relic where (rfillope is not null or rfillope <> '') and (rfilldate is not null)
         union all 
         select rnum,rwound,workid,taskname,imgpath,wfillope as oper,wfillopename as opername,wfilldate as opdate
         from wound where (wfillope is not null or wfillope <> '') and (wfilldate is not null)
         union all 
         select rnum,rname,rdclass,rera,rwarehouse,cfillope as oper,cfillopename as opername,cfilldate as opdate
         from catalog where (cfillope is not null or cfillope <> '') and (cfilldate is not null)
         union all 
         select snumber,rnum,werifyrecord,werifyperson,werifydate,vfillope as oper,vfillopename as opername,vfilldate as opdate
         from verify where (vfillope is not null or vfillope <> '') and (vfilldate is not null)
         union all 
         select rnum,jjudger,jdate,jrem,jopinion,jfillope as oper,jfillopename as opername,jfilldate as opdate
         from judge where (jfillope is not null or jfillope <> '') and (jfilldate is not null)
         union all  
         select rnum,rclass,rgrade,rresource,rrefnum,rauditope as oper,rauditopename as opername,rauditdate as opdate
         from relic where (rauditope is not null or rauditope <> '') and (rauditdate is not null)
         union all  
         select rnum,rwound,workid,taskname,imgpath,wauditope as oper,wauditopename as opername,wauditdate as opdate
         from wound where (wauditope is not null or wauditope <> '') and (wauditdate is not null)
         union all  
         select rnum,rname,rdclass,rera,rwarehouse,cauditope as oper,cauditopename as opername,cauditdate as opdate
         from catalog where (cauditope is not null or cauditope <> '') and (cauditdate is not null)
         union all  
         select snumber,rnum,werifyrecord,werifyperson,werifydate,vauditope as oper,vauditopename as opername,vauditdate as opdate
         from verify where (vauditope is not null or vauditope <> '') and (vauditdate is not null)
         union all  
         select rnum,jjudger,jdate,jrem,jopinion,jauditope as oper,jauditopename as opername,jauditdate as opdate
         from judge where (jauditope is not null or jauditope <> '') and (jauditdate is not null)
       
)大家帮我看下那的问题。

解决方案 »

  1.   

    werifydate标示符无效,但是我查了这个是没错的。我以前也遇到过总是莫名其妙的说标示符无效。
      

  2.   

    另外我从没个表里SELECT列时,能不能数目不一样?
      

  3.   

    第一个union all之前的select 语句决定你的列名...如果你想每个SQL列数目不一样,那么把少于这个数目的SQL语句相应列用常量代替select v1 c1,v2 c2,v3 c3,......
    union all
    select v1,v2,0,.....
     比如上面,你的外层SQL只能select c1,c2,c3,当然不用别名也行.
    下面的语句没有v3,你就用常量代替,当然要和相应列的数据类型匹配.你的werifydate不在第一句sql里,当然提示无效.
    反正要求就是每个SQL语句列数目要一样,每列的数据类型要一样.不够的用常量代替吧.