Re: problem with returning rows with null value
Date: Fri, 19 Jul 2002 17:43:23 +0500
Message-ID: <ah91h0$1qgc$1_at_serv2.vsi.ru>
Why not straightforward:
Select prod_id
, prod_srce_id
from products
where prod_srce_id like nvl(p_prod_srce_id,'%') or prod_srce_id is null
???
"Xander Burchartz" <xburchartz_at_hotmail.com> 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 - 14:43:23 CEST