pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedisnull function
8+ messages / 7 participants
[nested] [flat]
* isnull function
@ 1998-06-26 17:42 Kachun Lee <kachun@pathlink.net>
1998-06-26 19:13 ` Re: [SQL] isnull function] Bruce Momjian <maillist@candle.pha.pa.us>
1998-06-26 20:33 ` Re: [SQL] isnull function] Kachun Lee <kachun@pathlink.com>
0 siblings, 2 replies; 8+ messages in thread
From: Kachun Lee @ 1998-06-26 17:42 UTC (permalink / raw)
To: pgsql-sql@hub.org
Is there an isnull function avaliable in postgres, such as:
select isnull(dt_field, 'now') ...
Thanks
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] isnull function]
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
@ 1998-06-26 19:13 ` Bruce Momjian <maillist@candle.pha.pa.us>
1998-06-27 10:29 ` Re: [SQL] isnull function] James Olin Oden <joden@Lee.k12.nc.us>
1 sibling, 1 reply; 8+ messages in thread
From: Bruce Momjian @ 1998-06-26 19:13 UTC (permalink / raw)
To: kachun@pathlink.net; +Cc: pgsql-sql@hub.org
>
> Is there an isnull function avaliable in postgres, such as:
>
> select isnull(dt_field, 'now') ...
>
> Thanks
>
>
I don't tbink so, but it would be nice. I think Ingres has it. It also
would not be hard to write as a loadable function.
--
Bruce Momjian | 830 Blythe Avenue
maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] isnull function]
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
1998-06-26 19:13 ` Re: [SQL] isnull function] Bruce Momjian <maillist@candle.pha.pa.us>
@ 1998-06-27 10:29 ` James Olin Oden <joden@Lee.k12.nc.us>
0 siblings, 0 replies; 8+ messages in thread
From: James Olin Oden @ 1998-06-27 10:29 UTC (permalink / raw)
To: Bruce Momjian <maillist@candle.pha.pa.us>; +Cc: pgsql-sql@hub.org
> > Is there an isnull function avaliable in postgres, such as:
> >
> > select isnull(dt_field, 'now') ...
> >
> > Thanks
> >
> >
>
> I don't tbink so, but it would be nice. I think Ingres has it. It also
> would not be hard to write as a loadable function.
>
Is it possible to do something like:
select * from blah where x = ''
and get what he is asking for?
...james
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] isnull function]
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
@ 1998-06-26 20:33 ` Kachun Lee <kachun@pathlink.com>
1998-06-26 20:41 ` Re: [SQL] isnull function] Colin Dick <cdick@mail.ocis.net>
1998-06-27 02:11 ` Re: [SQL] isnull function] Bruce Momjian <maillist@candle.pha.pa.us>
1 sibling, 2 replies; 8+ messages in thread
From: Kachun Lee @ 1998-06-26 20:33 UTC (permalink / raw)
To: pgsql-sql@hub.org
At 03:13 PM 6/26/98 -0400, you wrote:
>>
>> Is there an isnull function avaliable in postgres, such as:
>>
>> select isnull(dt_field, 'now') ...
>>
>> Thanks
>>
>>
>
>I don't tbink so, but it would be nice. I think Ingres has it. It also
>would not be hard to write as a loadable function.
>
>--
>Bruce Momjian | 830 Blythe Avenue
>maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
> + If your life is a hard drive, | (610) 353-9879(w)
> + Christ can be your backup. | (610) 853-3000(h)
>
I tried, but the following code does not seem to work:
#include <string.h>
#include <stdio.h>
#include "postgres.h"
#include "libpq-fe.h"
#include "utils/dt.h"
DateTime * is_null(DateTime *, DateTime *);
DateTime * is_null (DateTime * dt, DateTime * def)
{
return dt ? dt : def;
}
I searched the doc/maillist, and I could not find how to test an arg for
NULL value. Should I post this to HACKER?
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] isnull function]
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
1998-06-26 20:33 ` Re: [SQL] isnull function] Kachun Lee <kachun@pathlink.com>
@ 1998-06-26 20:41 ` Colin Dick <cdick@mail.ocis.net>
1 sibling, 0 replies; 8+ messages in thread
From: Colin Dick @ 1998-06-26 20:41 UTC (permalink / raw)
To: Kachun Lee <kachun@pathlink.com>; +Cc: pgsql-sql@hub.org
I posted this question a while back and received a response of 'is null'
such as:
select * from try where field is null;
Will give you all entries where the field 'field' does not yet contain a
value. Works great and I hope will answer your original question.
(Now if only I could find an easy answer for mine :)
--
Colin Dick
On Call Internet Services
cdick@mail.ocis.net
On Fri, 26 Jun 1998, Kachun Lee wrote:
> At 03:13 PM 6/26/98 -0400, you wrote:
> >>
> >> Is there an isnull function avaliable in postgres, such as:
> >>
> >> select isnull(dt_field, 'now') ...
> >>
> >> Thanks
> >>
> >>
> >
> >I don't tbink so, but it would be nice. I think Ingres has it. It also
> >would not be hard to write as a loadable function.
> >
> >--
> >Bruce Momjian | 830 Blythe Avenue
> >maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
> > + If your life is a hard drive, | (610) 353-9879(w)
> > + Christ can be your backup. | (610) 853-3000(h)
> >
>
> I tried, but the following code does not seem to work:
>
> #include <string.h>
> #include <stdio.h>
> #include "postgres.h"
> #include "libpq-fe.h"
> #include "utils/dt.h"
>
> DateTime * is_null(DateTime *, DateTime *);
>
> DateTime * is_null (DateTime * dt, DateTime * def)
> {
> return dt ? dt : def;
> }
>
> I searched the doc/maillist, and I could not find how to test an arg for
> NULL value. Should I post this to HACKER?
>
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: [SQL] isnull function]
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
1998-06-26 20:33 ` Re: [SQL] isnull function] Kachun Lee <kachun@pathlink.com>
@ 1998-06-27 02:11 ` Bruce Momjian <maillist@candle.pha.pa.us>
1 sibling, 0 replies; 8+ messages in thread
From: Bruce Momjian @ 1998-06-27 02:11 UTC (permalink / raw)
To: kachun@pathlink.com; +Cc: hackers@postgreSQL.org
>
> I tried, but the following code does not seem to work:
>
> #include <string.h>
> #include <stdio.h>
> #include "postgres.h"
> #include "libpq-fe.h"
> #include "utils/dt.h"
>
> DateTime * is_null(DateTime *, DateTime *);
>
> DateTime * is_null (DateTime * dt, DateTime * def)
> {
> return dt ? dt : def;
> }
>
> I searched the doc/maillist, and I could not find how to test an arg for
> NULL value. Should I post this to HACKER?
>
>
Having DateTime* be a NULL does not represent a NULL value in SQL
internally.
Not sure how to do it, because I don't rememeber where the NULL checking
is done.
--
Bruce Momjian | 830 Blythe Avenue
maillist@candle.pha.pa.us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)
^ permalink raw reply [nested|flat] 8+ messages in thread
* ISNULL FUNCTION
@ 2002-12-09 14:30 Héctor Iturre <hhiturre@yahoo.com.ar>
0 siblings, 0 replies; 8+ messages in thread
From: Héctor Iturre @ 2002-12-09 14:30 UTC (permalink / raw)
To: pgsql-sql
HI,
HERE IS AN ALTERNATIVE TO USE THE SQL SERVER
ISNULL() FUNCTION
select case when FIELD_NAME isnull then 'EXPRESION'
else FIELD_NAME end
from calfiscal
where impuesto = 1
Ahora podés usar Yahoo! Messenger desde tu celular. Aprendé cómo hacerlo en Yahoo! Móvil: http://ar.mobile.yahoo.com/sms.html
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: ISNULL FUNCTION
@ 2002-12-10 01:53 2000 Informática <2000info@netsite.com.br>
0 siblings, 0 replies; 8+ messages in thread
From: 2000 Informática @ 2002-12-10 01:53 UTC (permalink / raw)
To: pgsql-sql
----- Original Message -----
From: "Héctor Iturre" <hhiturre@yahoo.com.ar>
To: <pgsql-sql@postgresql.org>
Sent: Monday, December 09, 2002 11:30 AM
Subject: [SQL] ISNULL FUNCTION
> HI,
> HERE IS AN ALTERNATIVE TO USE THE SQL SERVER
> ISNULL() FUNCTION
>
>
> select case when FIELD_NAME isnull then 'EXPRESION'
> else FIELD_NAME end
> from calfiscal
> where impuesto = 1
>
> Ahora podés usar Yahoo! Messenger desde tu celular. Aprendé cómo hacerlo
en Yahoo! Móvil: http://ar.mobile.yahoo.com/sms.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
Segue um exemplo que funciona satisfatoriamente.
Recrie esta função alterando os parametros (text, text e RETURNS text) para
os tipos que lhe for necessario.
CREATE FUNCTION isnull(text, text) RETURNS text AS 'SELECT (CASE (SELECT $1
is null) WHEN true THEN $2 ELSE $1 END) AS RESULT' LANGUAGE 'sql';
COMMENT ON FUNCTION isnull(text, text) IS 'Retorna o 2º arg se o 1º for
nulo';
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2002-12-10 01:53 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-06-26 17:42 isnull function Kachun Lee <kachun@pathlink.net>
1998-06-26 19:13 ` Re: [SQL] isnull function] Bruce Momjian <maillist@candle.pha.pa.us>
1998-06-27 10:29 ` Re: [SQL] isnull function] James Olin Oden <joden@Lee.k12.nc.us>
1998-06-26 20:33 ` Re: [SQL] isnull function] Kachun Lee <kachun@pathlink.com>
1998-06-26 20:41 ` Re: [SQL] isnull function] Colin Dick <cdick@mail.ocis.net>
1998-06-27 02:11 ` Re: [SQL] isnull function] Bruce Momjian <maillist@candle.pha.pa.us>
2002-12-09 14:30 ISNULL FUNCTION Héctor Iturre <hhiturre@yahoo.com.ar>
2002-12-10 01:53 Re: ISNULL FUNCTION 2000 Informática <2000info@netsite.com.br>
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