From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Select Command in Procedures |
Date: | 2011-02-03 11:23:19 |
Message-ID: | 20110203112319.GB14404@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Feb 03, 2011 at 02:26:10PM +0530, Adarsh Sharma wrote:
> 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 note that you used ' to delimit both function body, and strings
in function body.
so when parser hits the ' character before "SOI" - it assumes it to be
end of function!
simply use $$ quotes around function body, and you should be fine.
Best regards,
depesz
--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
From | Date | Subject | |
---|---|---|---|
Next Message | Thom Brown | 2011-02-03 11:31:01 | Re: Issues with generate_series using integer boundaries |
Previous Message | Wilton Wonrath | 2011-02-03 11:03:00 | Encoding Conversion |