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: Please help w/ SQL question

Re: Please help w/ SQL question

From: Mark D Powell <mark.powellNOmaSPAM_at_eds.com.invalid>
Date: 2000/05/25
Message-ID: <01740f27.a76d3d60@usw-ex0102-014.remarq.com>#1/1

Sean, I do not understand what you are asking for since by default if you select a column and it has not data a null is returned for that column.

In the where clause if you are dealing with a column that may be null then you use the 'is null' and/or 'is not null' clauses to test the column and not any of the relational operators, =, !=,
>, etc....

example:
select name
from x
where address is null;

When you need a value back for a column that might not have one you use the nvl function as in select nvl(col,'value_if_null')

I hope this helps.

In article <8gjl9g$g45$1_at_nnrp1.deja.com>, Sean <dolans_at_mydeja. com> wrote:
>I have two tables: a lookup and a value table. Let me
 describe them
>below:
>
>USER_LU
>===============
>USER_LU_ID (PK)
>--------------
>DISPLAY
>
>
>USER_LU_VALUE
>===============
>USER_LU_ID (PK)
>USERNAME (PK)
>---------------
>VALUE
>
>
>Some values that would be in the lookup table: {1, NAME}
 {2,ADDRESS}
>{3, CITY}
>Some values in the Value table : {1, 'foobarUsername', 'Sean'}
>
>What I am trying to do is get a list of ALL the lookups with a
 value
>for a certain username, but throw a NULL if not there as in:
>{given a username of foobarUsername}
>NAME Sean
>ADDRESS NULL
>CITY NULL
>
>ALL I Keep getting is
>NAME Sean
>
>
>I have tried outer joins but the problem comes in when I specify
>USERNAME = '{something}' It all goofs up.
>
>Any ideas of accomplishing this?
>Thanks,
>Sean
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
>
>

Received on Thu May 25 2000 - 00:00:00 CDT

Original text of this message

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