分层查询别名无法运行Oracle 11g

时间:2014-05-21 07:53:25

标签: sql oracle oracle11g oracle10g

我有以下查询

 Select item_number, parent_item_number, item_lable, level
   From ( -- inner query
          Select tech_key as item_number, 
                 unit_parent as parent_item_number,
                 Nvl2 (ltrim (rtrim(unit_kind) || unit_serial_number)),
                 Ltrim (rtrim (unit_kind || ' ' || unit_serial_number)) || nvl2 (unit_name, ' - ' || ltrim (rtrim (unit_name)), ''),
                 Ltrim (rtrim (unit_name) as item_lable
            From v_glb_unit) --end of inner query
  Where parent_item_number is not null 
  start with parent_item_number =1234
Connect by prior item_number = parent_item_number 
  order by level asc

它在Oracle 10g Windows上按预期工作,但已将数据库升级到Oracle 11g Linux - 它已不再有效。

它无法识别parent_item_number和item_number别名,并抛出ORA -00904。

值得注意的是,如果不使用别名,它可以工作,但这不是一个选项 - 内部查询是动态的。

修改

我将补充说v_glb_unit是一个符号,视图在dblink上。

0 个答案:

没有答案