Re: How to avoid nulls while writing string for dynamic query

Поиск
Список
Период
Сортировка
От Tomasz Myrta
Тема Re: How to avoid nulls while writing string for dynamic query
Дата
Msg-id 402B74F4.7070604@klaster.net
обсуждение исходный текст
Ответ на How to avoid nulls while writing string for dynamic query  ("Kumar" <sgnerd@yahoo.com.sg>)
Список pgsql-sql
Dnia 2004-02-12 13:31, Użytkownik Kumar napisał:
> The error is because of no value for column c1. If the column c1 is a 
> string I might have replace it with empty string. I don't want to 
> substitute with '0' which could work.
>  
> sqlstr := 'insert into test(c1, c2) values (' ||ISNULL(rec.c1,'0')||','
>                                                                     
> ||'\''||rec.c2||'\')';

Substitute it with NULL value:
sqlstr := 'insert into test(c1, c2) values(' || coalesce(rec.c1,'NULL') 
||...

Regards,
Tomasz Myrta


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

Предыдущее
От: "Kumar"
Дата:
Сообщение: How to avoid nulls while writing string for dynamic query
Следующее
От: ow
Дата:
Сообщение: Re: 7.4 - FK constraint performance