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 055BFD1C9BE for ; Thu, 12 Feb 2004 13:02:33 +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 86902-05 for ; Thu, 12 Feb 2004 09:02:31 -0400 (AST) Received: from serwer.skawsoft.com.pl (skawina.eu.org [80.48.213.66]) by svr1.postgresql.org (Postfix) with ESMTP id AE4B8D1B911 for ; Thu, 12 Feb 2004 09:02:26 -0400 (AST) Received: from klaster.net (backbone.zab.citynet.pl [212.244.6.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 7BCFC2B3D0; Thu, 12 Feb 2004 13:40:38 +0100 (CET) Message-ID: <402B74F4.7070604@klaster.net> Date: Thu, 12 Feb 2004 13:43:32 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.6b) Gecko/20031208 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> In-Reply-To: <00c001c3f164$1db30140$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/112 X-Sequence-Number: 16803 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