EXECUTE plpgsql

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

 



Hi all

I'm trying to get the next value from a sequence using a store procedure like this

create or replace function givemenext()  returns integer AS $$
DECLARE
newvalue integer;
getseq varchar(256);
BEGIN
return EXECUTE 'SELECT nextval(''test_id_seq'')';
END;
$$ language plpgsql

So when I do select * from givemenext()

I got this error message


ERROR:  type "execute" does not exist
CONTEXT:  SQL statement "SELECT  EXECUTE 'SELECT nextval(''test_id_seq'')'"
PL/pgSQL function "givemenext" line 11 at return


What I'm doing wrong?

Thanks in advance




[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