Issues that are applied when stored procedures (functions) are called in PostgreSQL

Source: Internet
Author: User
Tags postgresql

In PostgreSQL we tend to use select stored procedures in executing stored procedures, but if the stored procedure is called again, it cannot be used, and the perform stored procedure should be used to see the description of the official documentation

=====================================================================

executes an expression or command that has no result

Sometimes we want to evaluate an expression or a command, but discard the result (usually because we often invoke a function that has useful side effects but no useful result values). To do this in pl/pgsql , you can use the Perform statement:

PERFORM query;

This statement executes a query and discards the result. The wording of query is the same as the SQL Select command you normally write, just to replace the keyword select with the beginning of the PERFORM. The pl/pgsql variable is substituted into the command as usual. Similarly, if the command generates at least one row, then the special variable FOUND is set to True and False if no rows are born.

Note: We may want a select that does not have an into clause to meet this need, but the only way to accept it now is perform.

An example:

PERFORM create_mv (' cs_session_page_requests_mv ', my_query);


Issues that are applied when stored procedures (functions) are called in PostgreSQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.