Bug in Oracle

From: Vijay Raghavan <raghavav_at_cs.rpi.edu>
Date: 29 Jan 92 00:18:19 GMT
Message-ID: <x_9rr9#_at_rpi.edu>


I had created a small test database with the following tables.

create table BOOK

(

       TITLE     char(50)  not null,
       ISBN      char(15)  not null primary key,
       PUBLISHER char(50)  not null,
       YEAR      char(4)   not null,
       CUR_PRICE number    not null
     );

create table BORROWER

(
FNAME char(10), MINIT char(1), LNAME char(10) not null, SSN number(9) not null primary key, ADDRESS char(50), BR_TYPE char(5) not null references LIMIT(TYPE) ); create table COPY
(
ACCESSION char(15) not null primary key, COPY_ISBN char(15) not null references BOOK(ISBN), COPY_PRICE number not null ); create table COPY_BR
(
COPY_AC char(15) not null primary key references COPY(ACCESSION), BSSN number(9) not null references BORROWER(SSN), DATE_BR date not null );

On issuing the following query Oracle failed to give an error. Note that ISBN is an attribute of BOOK which is absent in the inner SELECT.

SELECT FNAME,LNAME, TITLE
   FROM BOOK,BORROWER,COPY,COPY_BR
   WHERE (

          BOOK.ISBN = COPY.COPY_ISBN AND
          BORROWER.SSN = COPY_BR.BSSN AND
          COPY.ACCESSION = COPY_BR.COPY_AC AND
          BORROWER.FNAME != 'Sylvester' AND BORROWER.LNAME != 'McCoy' AND
          BOOK.ISBN       IN (
                              SELECT   ISBN
				      ^^^^^^^^
                                 FROM  BORROWER,COPY_BR
                                 WHERE (
                                        BORROWER.SSN = COPY_BR.BSSN AND
                                        BORROWER.FNAME = 'Sylvester' AND
                                        BORROWER.LNAME = 'McCoy'
                                       )
                             )
         );


Vijay

-- 
===============================================================================
Vijay Raghavan                     | We can sort things out together.
Dept of Comp Sc                    | 
Rensselaer Polytechnic Institute   | Ph:(518)-276-4838  
Received on Wed Jan 29 1992 - 01:18:19 CET

Original text of this message