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

Home -> Community -> Usenet -> c.d.o.tools -> Re: HELP - select statement

Re: HELP - select statement

From: Holger Kreft <Holger.Kreft_at_sutter.de>
Date: Thu, 9 Nov 2000 16:58:06 +0100
Message-ID: <3a0ac9a7$1@news.ic-marl.de>

zak <zak_at_intrafunk.com> schrieb in im Newsbeitrag: 8ubnfl$200s$1_at_ulysses.noc.ntua.gr...
> i've got two tables (people, organizations) and one more (employees) to
 link
> these two
> in a many-to-many relation. I want to query the "people" table and when
> there is no data found (null values) in the columns (per_email, per_tel,
> per_addr), i
> want to have their organizations contact data (org_email, org_tel,
> org_addr).
>
> Is there a way to do this with nvl, decode or any other way?

Your question is not unique: Do you mean "no data found" or "null values"? "No data found" sounds more like an outer join problem. But i presume you mean "null values".

Try this:

select ... decode( per_email, null, org_email, per_email ) email, ... from ....

This means: IF per_email IS null THEN USE org_email ELSE USE per_email

regards

Holger Kreft Received on Thu Nov 09 2000 - 09:58:06 CST

Original text of this message

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