pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
EXECUTE plpgsql
2+ messages / 2 participants
[nested] [flat]

* EXECUTE plpgsql
@ 2007-08-11 15:34 Julio Leyva <jcleyva@hotmail.com>
  2007-08-11 16:04 ` Re: EXECUTE plpgsql Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Julio Leyva @ 2007-08-11 15:34 UTC (permalink / raw)
  To: pgsql-admin

Hi allI'm trying to get the next value from a sequence using a store procedure like thiscreate or replace function givemenext()  returns integer AS $$DECLAREnewvalue integer;getseq varchar(256);BEGINreturn EXECUTE 'SELECT nextval(''test_id_seq'')';END;$$ language plpgsqlSo when I do select * from givemenext()I got this error messageERROR:  type "execute" does not existCONTEXT:  SQL statement "SELECT  EXECUTE 'SELECT nextval(''test_id_seq'')'"PL/pgSQL function "givemenext" line 11 at returnWhat I'm doing wrong?Thanks in advance=

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: EXECUTE plpgsql
  2007-08-11 15:34 EXECUTE plpgsql Julio Leyva <jcleyva@hotmail.com>
@ 2007-08-11 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2007-08-11 16:04 UTC (permalink / raw)
  To: Julio Leyva <jcleyva@hotmail.com>; +Cc: pgsql-admin

Julio Leyva <jcleyva@hotmail.com> writes:
> Hi allI'm trying to get the next value from a sequence using a store proced=
> ure like thiscreate or replace function givemenext()  returns integer AS $$=
> DECLAREnewvalue integer;getseq varchar(256);BEGINreturn EXECUTE 'SELECT nex=
> tval(''test_id_seq'')';END;$$ language plpgsqlSo when I do select * from gi=
> vemenext()I got this error messageERROR:  type "execute" does not existCONT=
> EXT:  SQL statement "SELECT  EXECUTE 'SELECT nextval(''test_id_seq'')'"PL/p=
> gSQL function "givemenext" line 11 at returnWhat I'm doing wrong?Thanks in =
> advance=

Please try to use a less broken mailer :-(

Anyway, that seems like the hard way.  Why not just 

	return nextval('test_id_seq');

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-08-11 16:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-11 15:34 EXECUTE plpgsql Julio Leyva <jcleyva@hotmail.com>
2007-08-11 16:04 ` Tom Lane <tgl@sss.pgh.pa.us>

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