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
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