Re: problem with returning rows with null value

From: Bhooshan Prabhu <bhooshan.s.prabhu_at_orbitech.co.in>
Date: 19 Jul 2002 06:53:00 -0700
Message-ID: <16584988.0207190552.735f508b_at_posting.google.com>


I am not clear as to what do you exactly do you wish to do. Is it that you wish to replace the value of prod_srce_id with '%' if it is NULL? If that's the case,
you could do;
SQL> select prod_id, nvl(prod_srce_id,'%')   2 from prod;

Regards
Bhooshan

xburchartz_at_hotmail.com (Xander Burchartz) wrote in message news:<1fe97d7a.0207190156.153f4641_at_posting.google.com>...
> Hello,
>
> I have a problem with returning rows with a null value using a
> parameter. I think it should be easy, but I am not able to create a
> correct query.
>
> My query should return rows like:
>
> prod_id prod_srce_id
> --------------------------
> 1 AAA
> 2 BBB
> 3
> 4 DDD
>
> I tried the following:
>
> Select prod_id
> , prod_srce_id
> from products
> where prod_srce_id like nvl(p_prod_srce_id,'%')
>
> However, in this case the query doesn't return the row with prod_id 3.
> Do I have to use the decode function? If so, how would it look like?
>
> Thanks in advance,
>
> Xander
Received on Fri Jul 19 2002 - 15:53:00 CEST

Original text of this message