Searching addresses
572010Nov 14 2007 — edited Nov 15 2007Hi,
I have an ADDRESS table which stores components of an address e.g. level, building, street name, street type,...etc. Many of the fields are optional. I was wondering what's the best way to find out if a given address is in the table. I was thinking of creating a search column on the table which I could use to find addresses that were a close match to the given address and then do a full match on the records found.
The values in the search column would be something like upper( Spaces removed( street number|| substr(street name,1,5)||postcode)))
Also is this very good SQL. if not what's the alternative? I realise that functions on columns are not great but I'm not sure of any other way to do it.
Select Address_Id
From Address
Where nvl(street_name,' ') = nvl(l_street_name,' ')
and nvl(street_number,' ') = nvl(l_street_number,' ')
and nvl(street_Type,' ') = nvl(l_street_Type,' ')
and nvl(building,' ') = nvl(l_building,' ')
and suburb = l_suburb
where variables are those prefixed with l_
Thanks in advance.