pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feednvl() function
3+ messages / 3 participants
[nested] [flat]
* nvl() function
@ 2001-10-17 03:10 Steven Dahlin <sdahlin_plsql@hotmail.com>
2001-10-17 06:11 ` Re: nvl() function Andre Schnabel <a_schnabel@t-online.de>
2001-10-17 17:53 ` Re: nvl() function Joel Burton <joel@joelburton.com>
0 siblings, 2 replies; 3+ messages in thread
From: Steven Dahlin @ 2001-10-17 03:10 UTC (permalink / raw)
To: pgsql-sql
I am trying to find the equivalent in Postgresql to the Oracle sql function
nvl(). With nvl() you give two parameters. The first may be a field/column
or variable. If the value is not null then it is returned by the function.
For example the with query below if the :ClientParameter is passed then only
those rows which have a clientdesc matching the parameter are returned. If
the :ClientParameter is null then those rows which have clientdesc =
clientdesc are returned (all rows):
select clientid,
clientdesc
from clients
where ( clientdesc = nvl( :ClientParameter, clientdesc ) )
I have looked thru all the documentation I could find but nowhere were any
built-in SQL functions delineated. Does anyone know where the documentation
can be found?
Thanks,
Steve
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: nvl() function
2001-10-17 03:10 nvl() function Steven Dahlin <sdahlin_plsql@hotmail.com>
@ 2001-10-17 06:11 ` Andre Schnabel <a_schnabel@t-online.de>
1 sibling, 0 replies; 3+ messages in thread
From: Andre Schnabel @ 2001-10-17 06:11 UTC (permalink / raw)
To: pgsql-sql
Hi Steven,
you may use COALESCE. This function should have the same behaviour as
Oracle's nvl. For documentation look at
http://www.postgresql.org/idocs/index.php?functions-conditional.html
Andre
"Steven Dahlin" <sdahlin_plsql@hotmail.com> schrieb im Newsbeitrag
news:9qj13u$2v5l$1@news.tht.net...
> I am trying to find the equivalent in Postgresql to the Oracle sql
function
> nvl(). With nvl() you give two parameters. The first may be a
field/column
> or variable. If the value is not null then it is returned by the
function.
> For example the with query below if the :ClientParameter is passed then
only
> those rows which have a clientdesc matching the parameter are returned.
If
> the :ClientParameter is null then those rows which have clientdesc =
> clientdesc are returned (all rows):
>
> select clientid,
> clientdesc
> from clients
> where ( clientdesc = nvl( :ClientParameter, clientdesc ) )
>
> I have looked thru all the documentation I could find but nowhere were any
> built-in SQL functions delineated. Does anyone know where the
documentation
> can be found?
>
> Thanks,
> Steve
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: nvl() function
2001-10-17 03:10 nvl() function Steven Dahlin <sdahlin_plsql@hotmail.com>
@ 2001-10-17 17:53 ` Joel Burton <joel@joelburton.com>
1 sibling, 0 replies; 3+ messages in thread
From: Joel Burton @ 2001-10-17 17:53 UTC (permalink / raw)
To: Steven Dahlin <sdahlin_plsql@hotmail.com>; +Cc: pgsql-sql
On Tue, 16 Oct 2001, Steven Dahlin wrote:
> I am trying to find the equivalent in Postgresql to the Oracle sql function
> nvl(). With nvl() you give two parameters. The first may be a field/column
> or variable. If the value is not null then it is returned by the function.
> For example the with query below if the :ClientParameter is passed then only
> those rows which have a clientdesc matching the parameter are returned. If
> the :ClientParameter is null then those rows which have clientdesc =
> clientdesc are returned (all rows):
>
> select clientid,
> clientdesc
> from clients
> where ( clientdesc = nvl( :ClientParameter, clientdesc ) )
>
> I have looked thru all the documentation I could find but nowhere were any
> built-in SQL functions delineated. Does anyone know where the documentation
> can be found?
COALESCE is the SQL standard name for this. You'll find details in the
documentation, in the Conditional Expressions section (4.10). Copy at:
http://candle.pha.pa.us/main/writings/pgsql/sgml/functions-conditional.html
--
Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Independent Knowledge Management Consultant
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2001-10-17 17:53 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-17 03:10 nvl() function Steven Dahlin <sdahlin_plsql@hotmail.com>
2001-10-17 06:11 ` Andre Schnabel <a_schnabel@t-online.de>
2001-10-17 17:53 ` Joel Burton <joel@joelburton.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox