Snatch any course you want for just $15! Go to “Courses” and find a course ↓
Syntax of PL/pgSQL
Function parameters
18. OUT parameters – invoking the function #1
Handling exceptions


Great! So we've created a function that has an OUT parameter. But how do we call this function, and how can we retrieve the result placed in the OUT parameter once the query has returned?

We can use a function from one of the previous examples to demonstrate the two ways of calling such a function (second is the IN parameter, department):

SELECT get_employee_statistics(2);

Note that in the function call, we only pass in values for the IN parameters of the function; we do not pass in values for the OUT parameters of the function.

This statement returns the values of the OUT parameters – one column named get_employee_statistics with the following value of type record: ({value1},{value2}).


Run the template query and observe that the function returns one column named get_employee_statistics of type record.