pendari=> CREATE FUNCTION somefunc() RETURNS text AS $$ pendari$> pendari$> DECLARE pendari$> v_some_id int=14; pendari$> BEGIN pendari$> /* pendari$> more queries here... pendari$> */ pendari$> RETURN 'this is text'::text; pendari$> END; pendari$> $$ LANGUAGE plpgsql; CREATE FUNCTION pendari=> select somefunc(); somefunc -------------- this is text (1 row)