All Products
Search
Document Center

AnalyticDB for PostgreSQL:Stored procedures

Last Updated:Apr 28, 2023

A stored procedure of AnalyticDB for PostgreSQL contains a set of SQL statements. These SQL statements are permanently valid after they are compiled.

To run a stored procedure, you must specify the name and parameters of the stored procedure. AnalyticDB for PostgreSQL supports stored procedures in the following languages: PL/pgSQL - SQL procedural language.

You can use a procedural language to create a stored procedure.

PL/pgSQL - SQL procedural language

PL/pgSQL is an easy-to-use procedural language that comes with AnalyticDB for PostgreSQL. PL/pgSQL is designed to create a loadable procedural language that provides the following features:

  • Creates functions and trigger procedures.

  • Adds control structures to SQL procedure languages.

  • Performs complex computing.

  • Inherits user-defined types, functions, and operators.

  • Trusted by servers.

Functions created in PL/pgSQL and built-in functions of AnalyticDB for PostgreSQL can be used in the same scenarios. For example, you can create complex conditional computing functions and use the functions to define operators and index functions.