Re: ISNULL FUNCTION

From: 2000 Informática <2000info(at)netsite(dot)com(dot)br>
To: "PG SQL Mailim" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: ISNULL FUNCTION
Date: 2002-12-10 01:53:56
Message-ID: 001201c29fef$05abcae0$0101a8c0@Info2000.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


----- Original Message -----
From: "Héctor Iturre" <hhiturre(at)yahoo(dot)com(dot)ar>
To: <pgsql-sql(at)postgresql(dot)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';

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Oliver Elphick 2002-12-10 02:07:54 Re: Problem with a lookup table! Please help.
Previous Message Chris Jewell 2002-12-09 22:21:42 Re: Problem with a lookup table! Please help.