Views and outer joins - HELP!
Posted in 1994
I am experiencing some retrieval funnies when using an outer join in a view.
I have not found any reference to problems of this sort with views in any
of the manuals. Perhaps someone knows whether this is a bug or whether I
am specifying the view creation incorrectly.
I have a table called failures with the following columns:
found_date date not null,
found_station varchar(8,0) not null,
rtn_station_id smallint
The rtn_station_id column may be NULL for some rows.
I have a support table called station with the following:
station_id smallint not null,
station char(8) not null
I create a view called vfailures:
create view vfailures
(found_date, found_station, return_station)
as select
found_date, found_station, station
from failures, outer station
where rtn_station_id = station_id
Now when I run a query on the view WHERE return_station IS NOT NULL I get
ALL rows - ones with data and the NULL ones.
If I run a query specifying an exact value for return_station
(ie. WHERE return_station = "SMT4FV") I get all NULL rows AND all matching
rows.
If I create a temp table instead of the view and run the query for non-NULL's
I get the correct data. If I run the query specifying an exact value for
the return_station column in the temp table, I again, get the correct data.
So, what is wrong with the view? Is there a bug? Can I not specify in
the WHERE clause of a select the data in the column resulting from an
outer join?
I am running Informix On-line 5.01 on an HP9000/730 with HPUX 9.01.
Please email a response as I do not read this group often.
Thanks in advance.
ellen@hpdmd48.boi.hp.com