From: | "Guy Rouillier" <guyr(at)masergy(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: EXECUTE command in stored procedure |
Date: | 2006-10-08 04:25:45 |
Message-ID: | D4D1632DC736E74AB95FE78CD609007923B134@mtxexch01.add0.masergy.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Arunagiri K wrote:
> Dear All,
>
> How can I use EXCEUTE command in stored procedures?
> When using like this
>
> EXECUTE 'SELECT INTO REGNO REG_NO FROM ADMISSION WHERE SNAME = ' ||
> STUDNAME ;
>
> STUDNAME is a local variable;
>
> I am getting error like this
>
> ERROR: syntax error at or near "INTO" at character 8
>
> How can I solve this.
You don't mention which version of PostgreSQL you are using, or which
stored procedure language. I'll assume 8.1.x and PL/pgSQL. See section
36.6 in the documentation. Specifically, 36.6.5 says:
"SELECT INTO is not currently supported within EXECUTE."
However, if I'm understanding what you are trying to do, you shouldn't
need the EXECUTE at all. Doing a simple SELECT INTO should work for
you. Note also that since you are only retrieving a single value, you
can also avoid INTO altogether with something like:
REGNO := (select regno from admission where sname = myname);
--
Guy Rouillier
From | Date | Subject | |
---|---|---|---|
Next Message | stevegy | 2006-10-08 05:19:32 | Re: Hi, For the UTF-8 encoding |
Previous Message | Ron Johnson | 2006-10-08 02:22:53 | Re: How to force the parser to use index scan instead of |