Re: Bug in Oracle 7.3

From: L120bj <l120bj_at_aol.com>
Date: 1997/04/08
Message-ID: <19970408210500.RAA05500_at_ladder01.news.aol.com>#1/1


I don't think this is limited to Oracle 7.3, since I stumbled upon this feature a couple of years back. However, I wouldn't class it as a bug since I guess it's because of the ability to do correlated subqueries that it occurs. If you alias your tables, and prefix the columns with the table aliases (or the table name) as ORACLE recommends then you would get an error if you tried to reference tab2.fld1.

Rob



Subject: Bug in Oracle 7.3
From: "Bjørn Pedersen" <bjoped_at_online.no> Date: 8 Apr 1997 09:52:11 GMT
Message-ID: <01bc4402$76c0c720$0f2345c1_at_ssb-open>
  • bjp_at_ssb.no
    --
  • Serious BUG in Oracle 7.3:
  • An example:

drop table tab1;
create table tab1 (fld1 number,fld2 number); drop table tab2;
create table tab2 (fld3 number,fld4 number);

insert into tab1 values(1,1);
insert into tab1 values(1,2);
insert into tab1 values(1,3);
insert into tab1 values(2,1);
insert into tab1 values(2,2);
insert into tab1 values(2,3);

insert into tab2 values(1,1);

insert into tab2 values(1,2);
insert into tab2 values(1,3);

commit;

select fld1,fld2 from tab1
where fld1 in (select fld1 from tab2);

  • This statement will work even if tab2 only contains fld3 and fld4
  • because fld1 is found in tab1. The result will be erronous, because
  • all rows from tab1 will be selected. This behaviour could give very
  • strange results, if you by mistake includes a column-name from tab1
  • in the second select. This error must be considered a serious bug.

select fld1,fld2 from tab1
where fld1 in (select fld5 from tab2);

  • Will produce an error (as i rightly should).

select fld1,fld2 from tab1
where fld1 in (select fld3 from tab2);

  • Will give the desired result.
Received on Tue Apr 08 1997 - 00:00:00 CEST

Original text of this message