Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> joining on columns with null value

joining on columns with null value

From: <ryan_gaffuri_at_comcast.net>
Date: Mon, 28 Feb 2005 16:43:41 +0000
Message-Id: <022820051643.20455.42234A3D000125C300004FE72205886360079D9A00000E09A1020E979D@comcast.net>


I have to join two tables. all of the columns can be null. However, if there are nulls and the rest of the fields are the same, I want to join to succeed.I did a test case where i assumed that if i used the following, I would get a record returned even if there are nulls. where nvl(tableA.column,0) = nvl(tableB.column,0)

If both of these fields are null and i have the rest of the columns equivalent, this will not give me a record returned.

However, if i do:

where tableA.column1||tableA.column2||tableA.column3 = tableB.column1||tableB.column2||tableB.column3

then i get a successful join if one or more of the fields is null but atleast 1 is not. this is pretty ugly. Any better way to do this?

--
http://www.freelists.org/webpage/oracle-l
Received on Mon Feb 28 2005 - 11:46:54 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US