PLpgSQL Syntax
suggest changeCREATE [OR REPLACE] FUNCTION function_name (parameter_name parameter_type)
RETURNS return_type
AS $_block_name_$
DECLARE
-- declare something
BEGIN
-- do something
-- return something
END;
$_block_name_$
LANGUAGE plpgsql;
The quotes in an older form of this template were not SQL. Parameter types and the return type are written without quotes, unless the type name itself needs identifier quoting. The dollar-quote tag $_block_name_$ is arbitrary; $$ is enough when the body does not contain $$.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents