From: | "Bill" <bchie(at)opensys(dot)com(dot)hk> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: DateDiff, IsNull? |
Date: | 2001-08-15 03:44:27 |
Message-ID: | 9lcrij$15lk$2@news.tht.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
IsNull work like this
SELECT IsNull( user_name, '') FROM user ;
then the query will return empty string when the field user_name is null
Regards
Bill
> > Hello all,
> >
> > I am a newbie to postgreSQL, is it possible to write a "DateDiff",
> > "IsNull" function work same as the one in SQL Server and are there and
> > sample out there? And is it possible to override the existing function
and
> > operator like "+" to become a concate?
>
> I don't know what IsNull does but:
>
> template1=> select coalesce(NULL, 'Hello');
> case
> -------
> Hello
> (1 row)
>
> I do know what DateDiff does:
>
> template1=> select '2001-08-14'::date - '6 weeks'::interval;
> ?column?
> ------------------------
> 2001-07-03 00:00:00-05
> (1 row)
>
> Overloading operators? *Please* tell me that this is impossible.
>
> Alan Gutierrez
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-08-15 03:57:57 | Re: Temp tables being written to disk. Avoidable? |
Previous Message | Bill | 2001-08-15 03:44:01 | Re: DateDiff, IsNull? |