Re: Auomatic numbering, replacing nulls and IF

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Auomatic numbering, replacing nulls and IF
Дата
Msg-id 20020320083324.C45997-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Auomatic numbering, replacing nulls and IF  ("Pestilence" <me@work.com>)
Список pgsql-general
On Fri, 15 Mar 2002, Pestilence wrote:

> 2) The ISNULL function in both Oracle and MS-SQL takes 2 numbers and returns
> the second if the first is null, otherwise it returns the first. ISNULL in
> Postgres seems to be something quite different. Before I go writing my own
> function to do it, is there one already?
>

Coalesce

> 3) How do I do 'IF this_sql THEN that_sql'? I keep getting:
> parse error at or near "IF"

In what context?
If you mean like
IF (select * from foo) then delete from foo
kind of context, that kind of thing is availble
via pl functions but not AFAIK via direct sql.

If you mean in a select list:
select (if a is 2 then 3 else 1)
you can use CASE.



В списке pgsql-general по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: R: Bad timestamp external representation '2001-05-11
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: no quotes in arrays in 7.2