Stay organized with collections
Save and categorize content based on your preferences.
This section describes stored system procedures for Spanner.
A stored system procedure contains SQL code that you can reuse. Spanner
provides stored system procedures for you to use. You can't create your own stored
procedure in Spanner. You can only execute one stored
procedure at a time in a CALL statement.
Stored system procedures
To execute a stored system procedure, you use the
CALL
statement:
CALLprocedure_name(parameters);
Replace procedure_name with the name of the stored system
procedure.
Spanner supports the following stored system procedures:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Stored system procedures for GoogleSQL\n\nThis section describes stored system procedures for Spanner.\n\nA stored system procedure contains SQL code that you can reuse. Spanner\nprovides stored system procedures for you to use. You can't create your own stored\nprocedure in Spanner. You can only execute one stored\nprocedure at a time in a `CALL` statement.\n\nStored system procedures\n------------------------\n\nTo execute a stored system procedure, you use the\n[`CALL`](/spanner/docs/reference/standard-sql/procedural-language#call)\nstatement: \n\n```sql\nCALL procedure_name(parameters);\n```\n\nReplace \u003cvar translate=\"no\"\u003eprocedure_name\u003c/var\u003e with the name of the stored system\nprocedure.\n\nSpanner supports the following stored system procedures:\n\n- [Query cancellation](#query-cancellation)\n\n### Query cancellation\n\nThis section describes the query cancellation stored system procedure.\n\n#### Syntax\n\nCancels a query with the specified ***query_id***. \n\n CALL cancel_query(\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003equery_id\u003c/span\u003e\u003c/var\u003e)\n\n#### Description\n\nThis stored system procedure has the following parameters:\n\nQuery cancellations might fail in the following circumstances:\n\n- When Spanner servers are busy due to heavy query loads.\n- When the query is in the [process of restarting](/spanner/docs/introspection/oldest-active-queries#limitations) due to an error.\n\nIn both cases, you can run the query cancellation stored system procedureagain."]]