Skip site navigation (1) Skip section navigation (2)

Re: isnull

From: Julie Hunt <jhunt(at)chac(dot)qld(dot)edu(dot)au>
To: Joseph Shraibman <jks(at)p1(dot)selectacast(dot)net>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: isnull
Date: 2000-03-30 22:58:32
Message-ID: 38E3DC17.3F1A865@chac.qld.edu.au (view raw or flat)
Thread:
Lists: pgsql-sql
Yes, you're right.  I remember attempting to do an outer left join using the
nullif but without success so I used the case function instead with success.
Maybe someone else knows more about nullif and why it doesn't seem to work.

Regards,
Julie

Joseph Shraibman wrote:

> Julie Hunt wrote:
>
> > Sorry, I haven't come across ifnull
>
> Ah, I think the documentation that came with 6.5.3 was wrong, because
> http://www.postgresql.org/docs/postgres/functions.htm#AEN2257 has the function
> nullif  where ifnull was in my documentation.  I don't get errors now, but it
> just doesn't seem to do it's job.
>
> playpen=> insert into tablea values (100, null);
> INSERT 23168 1
> playpen=> select * from tablea;
> indexa|data
> ------+----
>      1|   1
>      2|   2
>      3|   2
>      4|   4
>      7|   7
>      6|   8
>      5|   8
>    100|
> (8 rows)
>
> playpen=> select *, data from tablea;
> indexa|data|data
> ------+----+----
>      1|   1|   1
>      2|   2|   2
>      3|   2|   2
>      4|   4|   4
>      7|   7|   7
>      6|   8|   8
>      5|   8|   8
>    100|    |
> (8 rows)
>
> playpen=> select *, nullif(data, 9) from tablea;
> indexa|data|case
> ------+----+----
>      1|   1|   1
>      2|   2|   2
>      3|   2|   2
>      4|   4|   4
>      7|   7|   7
>      6|   8|   8
>      5|   8|   8
>    100|    |
> (8 rows)
>
> >
> > Julie
> >
> > >Oops, my mistake.  I meant ifnull.  Whenever I try to use ifnull I get an
> > >error so I have to use a case when a = null then default else a end.
> > >
> > >Julie Hunt wrote:
> > >
> > >> There is a space between is and null: is null
> > >>
> > >> Regards
> > >>
> > >> Joseph Shraibman wrote:
> > >>
> > >> > Could someone give me an example of isnull?  Whenever I try it I get an
> > >> > error message.
> > >


In response to

  • Re: isnull at 2000-03-30 22:25:38 from Joseph Shraibman

Responses

  • Re: isnull at 2000-03-30 23:07:16 from Joseph Shraibman

pgsql-sql by date

Next:From: Julie HuntDate: 2000-03-30 23:06:56
Subject: Re: removing a field from a table
Previous:From: "Jim Freeman"Date: 2000-03-30 22:25:50
Subject: approve VKPts5 subscribe example

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group