Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Returning tables and sets
Summary
8. Summary

Instruction

Good job! Now, it's time to review what we learned in this part. There are multiple ways you can invoke one function inside another:

  • By using the SELECT INTO syntax:
    SELECT thumbs_down, thumbs_up
    INTO downvotes, upvotes
    FROM get_post_score(17);
    
  • By using a function in assignment:
    user_id := get_most_active_user();
  • If you want to omit the result returned by the function, use PERFORM:
    PERFORM remove_user_account(101);

If the function is not supposed to return a value, specify void as its return type.

Using functions, you can also return tables or sets with the following commands:

  • RETURNS TABLE along with RETURN QUERY or RETURN NEXT.
  • RETURNS SETOF along with RETURN QUERY or RETURN NEXT.

Exercise

Click Next exercise to go through the final recap exercises!