Re: EXECUTE plpgsql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Julio Leyva <jcleyva@xxxxxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

                http://www.postgresql.org/about/donate

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux