Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id AF8481337B6E for ; Thu, 3 Feb 2011 05:34:34 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 70218-05 for ; Thu, 3 Feb 2011 09:34:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from chrullrich.net (v29774.1blu.de [88.84.143.174]) by mail.postgresql.org (Postfix) with ESMTP id D53951337B68 for ; Thu, 3 Feb 2011 05:34:26 -0400 (AST) Received: from [217.31.70.82] (helo=[192.168.92.135]) by chrullrich.net with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.69) (envelope-from ) id 1PkvZv-0002Zq-A0; Thu, 03 Feb 2011 10:34:15 +0100 Message-ID: <4D4A7696.8030802@chrullrich.net> Date: Thu, 03 Feb 2011 10:34:14 +0100 From: Christian Ullrich User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-admin@postgresql.org CC: Adarsh Sharma Subject: Re: Select Command in Procedures References: <4D4A6E15.7080701@orkash.com> In-Reply-To: <4D4A6E15.7080701@orkash.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201102/8 X-Sequence-Number: 36647 * Adarsh Sharma wrote: > I am able to execute command successfully through CLI or pgAdmin . > > *create table user_news_new as select > record_id,field_name,field_value,news_date from user_news where > field_name in ('SOI','RelLoc','Description','Heading','news_date') and > field_value != '' ; * > > But I don't know when I put this command in a procedure, it shows error : > > CREATE FUNCTION user10() RETURNS void AS' > DECLARE > BEGIN > create table user_news_new as select > record_id,field_name,field_value,news_date from user_news where > field_name in ('SOI','RelLoc','Description','Heading','news_date') and > field_value != '' ; > END; > ' LANGUAGE 'plpgsql'; You are using single quotation marks around your function body already. Use dollar quoting instead. -- Christian