Stored procedures and functions in Spring JDBC - bhudevi0924/Spring-boot GitHub Wiki
Syntax for functions in PostgreSQL
CREATE [OR REPLACE] FUNCTION function_name
RETURN return_datatype AS $variable_name$
DECLARE
declaration;
[...]
BEGIN
< function_body> // executable code / bussiness logic of the function.
[...]
RETURN { variable_name | value }
END; LANGUAGE plpgsql;