数据库是Oracle 10.2.0.1.0 - 在Red Hat企业版Linux ES释放4(Nahant更新8)运行64位这是一个可能的Oracle错误还是我错过了一些东西?
在SQL * Plus下面的代码完美运行:
var comment_id number
exec :comment_id := 3052753
select e.label as doc_name,
e.url,
i.item_id,
'multi' as form_type
from cr_items i, cr_extlinks e
where i.parent_id = :comment_id
and e.extlink_id = i.item_id
UNION
select null as doc_name,
utl_raw.cast_to_varchar2(DBMS_LOB.SUBSTR(r.content, 2000, 1)) as url,
r.item_id,
'single' as form_type
from cr_revisions r
where r.revision_id = content_item.get_latest_revision(:comment_id);
/
在这种情况下,它返回2行,从UNION的每个部分返回1。 如果我改变调用content_item.get_latest_revision如下,它打破如下:
var comment_id number
exec :comment_id := 3052753
select e.label as doc_name,
e.url,
i.item_id,
'multi' as form_type
from cr_items i, cr_extlinks e
where i.parent_id = :comment_id
and e.extlink_id = i.item_id
UNION
select null as doc_name,
utl_raw.cast_to_varchar2(DBMS_LOB.SUBSTR(r.content, 2000, 1)) as url,
r.item_id,
'single' as form_type
from cr_revisions r
where r.revision_id = (select content_item.get_latest_revision(:comment_id)
from dual);
/
错误:
SQL> where r.revision_id = (select content_item.get_latest_revision(:comment_id) from dual)
*
ERROR at line 14:
ORA-00904: : invalid identifier
现在,什么是真正的疯狂这块SQL的是,第二个示例以上是只有案例中断。例如,如果我在上面的示例2中进行查询,并从工会两侧删除doc_name字段,则突然再次发生作用。或者如果我删除utl_raw.cast_to_varchar2位或联合本身(并分别运行每个部分)。这只是UNION,AND子句和函数调用的精确组合。
有人提出,它可能是错误6038461,'与UNION和快速DUAL子查询SQL错误的结果',但我不认为这是一个很好的选择。
任何人都有线索是什么与第二个查询?
PS我要补充一点,蟾蜍没有错误 - 查询运行良好......
同意6038461现在看起来不太合适;在[上一个问题](http://stackoverflow.com/q/11155855/266304)中,不清楚它是错误还是给出错误结果。我很确定它是* a *错误,但看不到完全匹配。您可能需要使用Oracle提出服务请求。 –
由于查询在TOAD中运行良好,因此在黑暗中进行了总计拍摄,您使用的是哪种版本的SQL Plus? –
您正在运行10gR2的未打补丁版本。这是为什么? – APC