Porting SQL Server -> PostgreSQL ( SELECT INTO problem... )

Поиск
Список
Период
Сортировка
От Patrick FICHE
Тема Porting SQL Server -> PostgreSQL ( SELECT INTO problem... )
Дата
Msg-id 85058ADF852DD5118FD50002A528A5B6079A26@SERVEUR
обсуждение исходный текст
Ответы Porting SQL Server -> PostgreSQL ( SELECT INTO problem... )
Список pgsql-general
Hi,

I'm porting an application built upon stored procedures from SQL Server to
PostgreSQL.
Most of the work was done without too many problems but now I'm testing and
I'm facing to a comportment which seems to be different.

In SQL Server, if you do :
SELECT @var1 = @var1 + col1 FROM tbl1 WHERE col2 = 1
If there is no record in tbl1 with this condition, @var1 remains unchanged.

I changed it in PostgreSQL to
SELECT INTO _var1 _var1 || col1 FROM tbl1 WHERE col2 = 1
It there is no record in tbl1 with this condition, _var1 is now NULL.

Is there an easy way to have the same result as in SQL Server or do I have
use a temporary variable and concatenate values after ?

Patrick Fiche
email : patrick.fiche@aqsacom.com
tél : 01 69 29 36 18


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

Предыдущее
От: Jenia
Дата:
Сообщение: User-Defined functions
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: User-Defined functions