October 14, 2022 at 12:00 am
Comments posted to this topic are about the item PostgreSQL User Defined Functions
October 14, 2022 at 5:06 pm
Thank you for the article. This is nicely explained. However I have a couple of questions.
The basic template is
CREATE [OR REPLACE] FUNCTION function_name (arguments)
RETURNS return_datatype AS $variable_name$
DECLARE
declaration;
[...]
BEGIN
< function_body >
[.. logic]
RETURN { variable_name | value }
END;
LANGUAGE language_name;
I saw return datatype as $$ and did not see a variable name there
Also in one of your examples the language was not listed after the END keyword.
Are these differences the same or somehow different from what the template presents?
----------------------------------------------------
October 14, 2022 at 5:29 pm
The $$ is a delimiter you use to indicate where the function definition starts and ends.
The language can also be listed after the 'returns' keyword before the start of the function definition. It works just fine.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy