Stored procedures for PostgreSQL Stay organized with collections Save and categorize content based on your preferences.
Astored procedure is a collection of statements that can be called from otherqueries or other stored procedures. Some stored procedures aresystemprocedures that are built into Spanner. System procedures don't needto be created. Spanner lets you use system procedures.
Because you can't use Spanner to create a stored procedure,Spanner doesn't support stored procedures that aren't built in systemprocedures.
Run a stored system procedure
To run a stored system procedure, you use theCALLstatement:
CALLprocedure_name(parameters);
Replaceprocedure_name with the name of the stored system procedure.You can run one stored system procedure at a time.
Stored system procedures
Spanner supports the following stored system procedure:
Query cancellation
This section describes the query cancellation stored system procedure.
Syntax
Thecancel_query stored system procedure cancels a query. You specify thequery to cancel using itsquery_id.
CALLspanner.cancel_query(query_id)Description
Thecancel_query stored system procedure has the following parameters:
| Parameter | Type | Description |
|---|---|---|
query_id | STRING | Specifies the ID for the query that you want to cancel. |
Query cancellations might fail because of one or more of the following:
- The Spanner servers are busy due to heavy query loads.
- The query is in the process of restarting due to an error.
If one of these causes the query to fail, you can run the query cancellationstored system procedure again.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.