From: Christian Ullrich <chris@chrullrich.net>
To: pgsql-admin@postgresql.org
Cc: Adarsh Sharma <adarsh.sharma@orkash.com>
Subject: Re: Select Command in Procedures
Date: Thu, 03 Feb 2011 10:34:14 +0100
Message-ID: <4D4A7696.8030802@chrullrich.net> (raw)
In-Reply-To: <4D4A6E15.7080701@orkash.com>
References: <4D4A6E15.7080701@orkash.com>
* 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: chris@chrullrich.net, adarsh.sharma@orkash.com
Subject: Re: Select Command in Procedures
In-Reply-To: <4D4A7696.8030802@chrullrich.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox