您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

Oracle 11g下ORA-01417的解决方法

2024/3/29 6:03:11发布4次查看
今天有客户反馈,有一条sql在12c上没有问题,在oracle 11g上就报错,报错内容是ora-01417: 表可以外部连接到至多一个其他的表。分
今天有客户反馈,有一条sql在12c上没有问题,在oracle 11g上就报错,报错内容是ora-01417: 表可以外部连接到至多一个其他的表。分析了下sql,抽象为下列的例子。
在12c下没有问题:
sql> select * from v$version;
banner                                                                              con_id
-------------------------------------------------------------------------------- ----------
oracle database 12c enterprise edition release 12.1.0.1.0 - 64bit production              0
pl/sql release 12.1.0.1.0 - production                                                    0
core    12.1.0.1.0      production                                                        0
tns for linux: version 12.1.0.1.0 - production                                            0
nlsrtl version 12.1.0.1.0 - production                                                    0
drop table test1 purge;
drop table test2 purge;
drop table test3 purge;
create table test1 (id number primary key);
create table test2 (id number);
create table test3 (dept_id number,measure_id number);
insert into test1 values(1);
insert into test1 values(2);
insert into test1 values(3);
insert into test2 values(10);
insert into test2 values(20);
insert into test3 values(1,10);
commit;
sql> select *
      from test1, test2, test3
    where test1.id = test3.dept_id(+)
      and test2.id = test3.measure_id(+);
        id        id    dept_id measure_id
---------- ---------- ---------- ----------
        1        10          1        10
        2        10
        2        20
        3        20
        1        20
        3        10
已选择6行。
在11g下有问题:
sql> select * from v$version;
banner
--------------------------------------------------------------------------------
oracle database 11g enterprise edition release 11.2.0.1.0 - 64bit production
pl/sql release 11.2.0.1.0 - production
core    11.2.0.1.0      production
tns for linux: version 11.2.0.1.0 - production
nlsrtl version 11.2.0.1.0 - production
sql> select *
      from test1, test2, test3
    where test1.id = test3.dept_id(+)
      and test2.id = test3.measure_id(+);
 where test1.id = test3.dept_id(+)
                *
第 3 行出现错误:
ora-01417: 表可以外部连接到至多一个其他的表
--把test1和test2联合起来,再与test3关联,问题解决
sql> select *
      from (select test1.id dept_id, test2.id measure_id from test1, test2) a,
          test3
    where a.dept_id = test3.dept_id(+)
      and a.measure_id = test3.measure_id(+);
在centos 6.4下安装oracle 11gr2(x64)
oracle 11gr2 在vmware虚拟机中安装步骤
debian 下 安装 oracle 11g xe r2
oracle linux 6.5安装oracle 11.2.0.4 x64
本文永久更新链接地址:

该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录