Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 分层查询别名不工作Oracle 11g_Sql_Oracle_Oracle11g_Oracle10g - Fatal编程技术网

Sql 分层查询别名不工作Oracle 11g

Sql 分层查询别名不工作Oracle 11g,sql,oracle,oracle11g,oracle10g,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_nu

我有以下疑问

 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之后,它就不再工作了

它不识别父项号和项号别名,并抛出ORA-00904

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

编辑


我要补充一点,v_glb_unit是一个符号,视图通过一个数据库链接。

好吧,您已经花了很多时间让您的查询难以阅读,但看起来还不错。我无法想象11G会有这个问题(我在我们的迁移过程中没有遇到过),但是如果你认为会,也许会提交错误报告。是的,我很抱歉-使用智能手机复制代码。。。我不确定是什么原因导致了这个问题,我只知道它在我们以前的数据库上起作用了什么版本的11g?您是否应用了终端修补程序集?Oracle Database 11g Enterprise Edition Relese 11.2.0.3.0-64位生产版。我不确定修补程序集,我需要询问dba。