# Procedural SQL Reference

This section contains information about SingleStore Procedural SQL (PSQL), which encompasses stored procedures, user-defined scalar-value functions (UDFs), user-defined table-valued functions (TVFs), and user-defined aggregate functions (UDAFs).

## Wasm-based Functions

SingleStore also supports Wasm-based functions. Refer to [Code Engine - Powered by Wasm](https://docs.singlestore.com/db/v9.1/reference/code-engine-powered-by-wasm.md) for information on creating Wasm-based UDFs and TVFs. To create Wasm-based UDAFs, refer to [CREATE AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-aggregate.md). If your logic and data structures can be implemented in PSQL with reasonable effort in a way that performs well, use PSQL. For integrating more complex logic and data structures, or using existing C/C++ or Rust code, SingleStore recommends using Wasm-based functions.

For information on when to use PSQL, Wasm-based, or external functions, refer to [Choose Between PSQL, Wasm-based, and External Functions](https://docs.singlestore.com/db/v9.1/developer-resources/procedural-extensions/choose-between-psql-wasm-based-and-external-functions.md).

## Extensions

Extensions in SingleStore allow you to combine user-defined objects, such as UDFs or UDAFs, into a packaged archive and then create, manage, and deploy these objects and other resources using the `CREATE EXTENSION` command. Extensions support both PSQL and Wasm-based functions. Refer to [Extensions](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/extensions.md) for more information.

## Related Topics

* [Procedural Extensions](https://docs.singlestore.com/db/v9.1/developer-resources/procedural-extensions.md)
* [Code Engine - Powered by Wasm](https://docs.singlestore.com/db/v9.1/reference/code-engine-powered-by-wasm.md)

## In this section

* [Anonymous Code Blocks](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/anonymous-code-blocks.md)
* [Control Flow Statements](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/control-flow-statements.md)
* [Exceptions and Exception Handling](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/exceptions-and-exception-handling.md)
* [MySQL Client Delimiters](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/mysql-client-delimiters.md)
* [Overloaded Functions and Stored Procedures](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/overloaded-functions-and-stored-procedures.md)
* [Transactions in Stored Procedures](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/transactions-in-stored-procedures.md)
* [Extensions](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/extensions.md)
* [CREATE AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-aggregate.md)
* [CREATE EXTERNAL FUNCTION](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-or-replace-external-function.md)
* [CREATE FUNCTION (TVF)](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-function-tvf.md)
* [CREATE FUNCTION (UDF)](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-function-udf.md)
* [CREATE PROCEDURE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-procedure.md)
* [CREATE TEMPORARY PROCEDURE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-or-replace-temporary-procedure.md)
* [DROP FUNCTION](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/drop-function.md)
* [DROP PROCEDURE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/drop-procedure.md)
* [DROP AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/drop-aggregate.md)
* [SHOW AGGREGATES](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-aggregates.md)
* [SHOW CREATE AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-create-aggregate.md)
* [SHOW CREATE FUNCTION](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-create-function.md)
* [SHOW CREATE PROCEDURE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-create-procedure.md)
* [SHOW FUNCTIONS](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-functions.md)
* [SHOW PROCEDURES](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-procedures.md)
* [%ROWTYPE and %TYPE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/rowtype-and-type.md)
* [ARRAY](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/array.md)
* [CALL](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/call.md)
* [CREATE\_ARRAY](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-array.md)
* [COLLECT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/collect.md)
* [ECHO](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/echo.md)
* [ECHO SELECT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/echo-select.md)
* [EXECUTE IMMEDIATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/execute-immediate.md)
* [INSERT\_ALL](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/insert-all.md)
* [RECORD](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/record.md)
* [ROW](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/row.md)
* [QUERY](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/query.md)
* [SCALAR](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/scalar.md)
* [TO\_QUERY](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/to-query.md)

***

Modified at: March 5, 2026

Source: [/db/v9.1/reference/sql-reference/procedural-sql-reference/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/)

(An index of the documentation is available at /llms.txt)
