Virtual procedures in Pipes are similar to stored procedures in relational database management systems: if you need to write and execute the same query from time to time, you can save it as a virtual procedure and then just call it. We call them virtual procedures to distinguish from what we call stored procedures in Pipes - that is, preconfigured procedures for specific operations.

You can use virtual procedures to execute queries and other SQL commands, define temporary tables, add data to temporary tables, walk through result sets, use loops, and use conditional logic.

Virtual procedures are defined using the Pipes procedural language. In this section, we describe creating and executing virtual procedures and give detailed descriptions of different statements used in our procedural language.