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 402C6FB8.8000606@klaster.net
обсуждение исходный текст
Ответ на Re: How to avoid nulls while writing string for dynamic query  ("Kumar" <sgnerd@yahoo.com.sg>)
Список pgsql-sql
Dnia 2004-02-13 05:53, Użytkownik Kumar napisał:

> I am having problem there. see what happens
> 
> sqlstr := 'insert into test(c1, c2) values ('||COALESCE(rec.c1,'NULL')||','
>         ||'\''||rec.c2||'\')';

You are preparing a string, so make sure you have strings everywhere:
sqlstr := 'insert into test(c1, c2) values 
('||COALESCE(rec.c1::text,'NULL')||','||'\''||rec.c2||'\')';

Regards,
Tomasz Myrta



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

Предыдущее
От: "David Witham"
Дата:
Сообщение: Re: Index question
Следующее
От: Mona
Дата:
Сообщение: How to unsubscribe