PLpgSQL Syntax

suggest change
CREATE [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 $$.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents