为什么Oracle在子子查询中没有看到别名?

时间:2012-10-11 15:11:44

标签: sql oracle

看起来Oracle没有在子查询中看到c别名。返回的错误是:ORA-00904:“C”。“FLH_PUNTO_EROGAZIONE”:identifyicativo non valido

似乎oracle只在1度外部声明中寻找别名

SELECT (SELECT 1
          FROM (SELECT 1 AS SomeAlias
                  FROM out.ANAG_PDF_PWR_T840
                 WHERE campo34 = c.flh_punto_erogazione
                UNION
                SELECT 1
                  FROM out.ANAG_PDF_T812
                 WHERE campo34 = c.flh_punto_erogazione) Something)
  FROM etl_elab_interf_flat f, eni_flussi_hub c,  eni_info_extra_forn ief, conf_forniture forn
 WHERE     f.eif_campo198(+) = c.flh_id_messaggio
       AND f.idde_identif_dati_ext_id(+) = c.idde_identif_dati_ext_id
AND c.flh_punto_erogazione IN ('8003576015', '8003576054', '8003576551', '8003576565')
       AND eif_campo200 IN ('FORNITURA_ENI')
       AND c.flh_flag_ann = 'N'
       --
       AND forn.forn_old_codice_fornitura (+) = c.flh_fornitura
       AND forn.forn_fornitura_id  = ief.forn_fornitura_id(+);

1 个答案:

答案 0 :(得分:0)

我认为c.flh_punto_erogazione和/或查询没有任何问题,因为它的作用类似于

SQL> select (select 1 
               from dual b 
              where c.dummy||'YZ'=b.dummy||'YZ') col
       from dual c
      where c.dummy||'YZ'='XYZ';

COL
----------
1

除非表格flh_punto_erogazione中不存在列eni_flussi_hub,否则您可能拼写错误。