Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Syntax of PL/pgSQL
Function parameters
18. OUT parameters – invoking the function #1
Handling exceptions
Summary

Instruction

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}).

Exercise

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