X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7C1BFD1D3A4 for ; Fri, 13 Feb 2004 06:30:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 61184-03 for ; Fri, 13 Feb 2004 02:30:39 -0400 (AST) Received: from serwer.skawsoft.com.pl (skawina.eu.org [80.48.213.66]) by svr1.postgresql.org (Postfix) with ESMTP id A9BB1D1B4B5 for ; Fri, 13 Feb 2004 02:30:37 -0400 (AST) Received: from klaster.net (backbone.zab.citynet.pl [212.244.6.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 1A34A2B3CB; Fri, 13 Feb 2004 07:30:32 +0100 (CET) Message-ID: <402C6FB8.8000606@klaster.net> Date: Fri, 13 Feb 2004 07:33:28 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.6) Gecko/20040113 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: Kumar Cc: psql Subject: Re: How to avoid nulls while writing string for dynamic query References: <00c001c3f164$1db30140$7502a8c0@hdsc.com> <402B74F4.7070604@klaster.net> <006701c3f1ed$6610dc30$7502a8c0@hdsc.com> In-Reply-To: <006701c3f1ed$6610dc30$7502a8c0@hdsc.com> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/136 X-Sequence-Number: 16827 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