Check out example codes for "plpgsql create function". It will help you in understanding the concepts better.

Code Example 1

postgres=# Create or replace function fun1(n int) returns int 

as

$$

Begin

Insert into test values (n,'2019-11-26');

Return 1;

End;

$$

Language 'plpgsql';

CREATE FUNCTION

postgres=# 

Code Example 2

CREATE FUNCTION function_name(argument1 type,argument2 type)
 RETURNS type AS
BEGIN
  staments;
END;
LANGUAGE 'language_name';

Learn ReactJs, React Native from akashmittal.com