Thread: Create function problem
Hello
I cannot write new function with local variables:
CREATE FUNCTION "get_new_id1" () RETURNS bigint AS'
declare
id bigint;
begin
id:=nextval(\'id_sequence\'::text);
return id;
end;
'LANGUAGE 'sql' VOLATILE ;
declare
id bigint;
begin
id:=nextval(\'id_sequence\'::text);
return id;
end;
'LANGUAGE 'sql' VOLATILE ;
Error message see when compiling:
ERROR: parser: parse error at or near "bigint" at character 16
That I do wrong?
HelloI cannot write new function with local variables:CREATE FUNCTION "get_new_id1" () RETURNS bigint AS'
declare
id bigint;
begin
id:=nextval(\'id_sequence\'::text);
return id;
end;
'LANGUAGE 'sql' VOLATILE ;Error message see when compiling:ERROR: parser: parse error at or near "bigint" at character 16That I do wrong?
HelloI cannot write new function with local variables:CREATE FUNCTION "get_new_id1" () RETURNS bigint AS'
declare
id bigint;
begin
id:=nextval(\'id_sequence\'::text);
return id;
end;
'LANGUAGE 'sql' VOLATILE ;Error message see when compiling:ERROR: parser: parse error at or near "bigint" at character 16That I do wrong?
"Yaroslav Ulyanov" <yulyanov@mera.ru> writes: > CREATE FUNCTION "get_new_id1" () RETURNS bigint AS' > declare > id bigint; > begin > id:=3Dnextval(\'id_sequence\'::text); > return id; > end; > 'LANGUAGE 'sql' VOLATILE ; That's plpgsql code, but you've declared the function as language 'sql'. regards, tom lane