问题描述
嗨,
我在12C和11g数据库中运行了以下语句。
在12 C中,它成功执行,但在11i中,它抛出了以下错误。
可以知道为什么12c执行而11g不执行吗?
我在12C和11g数据库中运行了以下语句。
select * from temp0101 a ,temp0101 b ,temp0101 c where 1 = 1 and a.sno = b.sno(+) and c.sno = b.sno(+);复制
在12 C中,它成功执行,但在11i中,它抛出了以下错误。
ORA-01417: a table may be outer joined to at most one other table 01417. 00000 - "a table may be outer joined to at most one other table" *Cause: a.b (+) = b.b and a.c (+) = c.c is not allowed *Action: Check that this is really what you want, then join b and c first in a view.复制
可以知道为什么12c执行而11g不执行吗?
专家解答
那是因为它是在12c中修复的!
https://docs.oracle.com/database/121/NEWFT/chapter12101.htm#NEWFT138
如文档所示,11.2中的解决方法是使用ANSI联接:
In previous releases of Oracle Database, in a query that performed outer joins of more than two pairs of tables, a single table could be the null-generated table for only one other table. Beginning with Oracle Database 12c, a single table can be the null-generated table for multiple tables. Prior to Oracle Database 12c, having multiple tables on the left hand side of an outer join was illegal and resulted in an ORA-01417 error. The only way to execute such a query was to translate it into ANSI syntax. In Oracle Database 12c, the native syntax for a LEFT OUTER JOIN has been expanded to allow multiple tables on the left hand side复制
https://docs.oracle.com/database/121/NEWFT/chapter12101.htm#NEWFT138
如文档所示,11.2中的解决方法是使用ANSI联接:
select * from temp0101 a ,temp0101 b ,temp0101 c where 1 = 1 and a.sno = b.sno(+) and c.sno = b.sno(+); ORA-01417: a table may be outer joined to at most one other table select * from temp0101 a left join temp0101 b on a.sno = b.sno left join temp0101 c on c.sno = b.sno; SNO NAME SNO NAME SNO NAME 1 Santosh 1 Santosh 1 Santosh 2 Santu 2 Santu 2 Santu复制
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【专家有话说第五期】在不同年龄段,DBA应该怎样规划自己的职业发展?
墨天轮编辑部
1278次阅读
2025-03-13 11:40:53
Oracle RAC ASM 磁盘组满了,无法扩容怎么在线处理?
Lucifer三思而后行
770次阅读
2025-03-17 11:33:53
Oracle+Deepseek+Dify 实现数据库数据实时分析
bicewow
690次阅读
2025-03-06 09:41:49
【ORACLE】ORACLE19C在19.13版本前的一个严重BUG-24761824
DarkAthena
566次阅读
2025-03-04 14:33:31
Oracle避坑指南|同名表导出难题:如何精准排除指定用户下的表?
szrsu
531次阅读
2025-03-05 00:42:34
2月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
455次阅读
2025-03-13 14:38:19
Ogg23ai高手必看-MySQL Innodb Cluster跟oracle的亲密接触
曹海峰
450次阅读
2025-03-04 21:56:13
【ORACLE】char类型和sql优化器发生的“错误”反应
DarkAthena
406次阅读
2025-03-04 23:05:01
什么,oracle 主机用户被删了?原来是虚惊一场!
Lucifer三思而后行
403次阅读
2025-03-03 21:12:09
Oracle 如何修改 db_unique_name?强迫症福音!
Lucifer三思而后行
342次阅读
2025-03-12 21:27:56