-1

I understand what Out and In-Out parameters are, but I can't seem to understand a good use case for them. Is it to make functions more descriptive? Or is there a practical benefit/need for using them?

1 Answer 1

0

No, there is not much benefit, it is just an alternative syntax.

These two definitions are the same:

CREATE FUNCTION f(IN a integer, OUT b integer, OUT c integer) RETURNS SETOF record

CREATE FUNCTION f(a integer) RETURNS TABLE (b integer, c integer)

There is one difference that may justify the syntax: with OUT parameters, you can use RETURNS recurd to create a function that is not table function, but returns several columns. That seems like a compelling use case to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.