From: Adarsh Sharma <adarsh.sharma@orkash.com>
To: pgsql-admin@postgresql.org
Subject: Select Command in Procedures
Date: Thu, 03 Feb 2011 14:27:57 +0530
Message-ID: <4D4A6E15.7080701@orkash.com> (raw)
Dear all,
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';
Error :
globe=# CREATE FUNCTION user10() RETURNS void AS'
globe'# DECLARE
globe'# BEGIN
globe'# 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 != '' ;
globe'# END;
globe'# ' LANGUAGE 'plpgsql';
ERROR: syntax error at or near "SOI"
LINE 4: ...ue,news_date from user_news where field_name in ('SOI','RelL...
^
Please help as I stuck with this issue.
Thanks & Regards
Adarsh Sharma
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: adarsh.sharma@orkash.com
Subject: Re: Select Command in Procedures
In-Reply-To: <4D4A6E15.7080701@orkash.com>
* 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