如何访问内部查询列

时间:2014-07-25 14:58:55

标签: sql oracle

我需要在更新语句中使用此查询

UPDATE RUN_RESULT 
SET UNQKEY = ( 
                select UNQKEY_VALUE 
                from ( 
                  select distinct RUN_ID,
                           TOCID, 
                         'UNQKEY' || r as UNQKEY , 
                           TOCNAME,
                           UNIQUENESS_COLUMN_ID, 
                         DECODE( r, 1, UNQKEY1, 2, UNQKEY2, 3, UNQKEY3, 4, UNQKEY4 , 5, UNQKEY5) AS UNQKEY_VALUE 
                  from TOC TOC,
                    RULE RL, 
                     RUN_RESULT RR,
                   (select rownum r 
                      from all_objects 
                      where rownum <=5) 
                WHERE RL.RULE_SET_ID=RR.RULE_SET_ID 
                AND TOC.TOCID= RR.TOC_ID ) t 
          WHERE UNIQUENESS_COLUMN_ID like UNQKEY
          and UNQKEY_VALUE IS NOT NULL ) 
      Where ????? 

我必须使用内部查询列,如RUN_ID,TOCID,如何在内部查询列中访问

0 个答案:

没有答案