The ALTER PROCEDURE modifies a .
Required privileges
Refer to the respective subcommands.
Synopsis
Parameters
| Parameter | Description |
|---|
proc_name | The name of the procedure to alter. |
routine_param | An optional list of procedure parameters. |
Subcommands
| Subcommand | Description |
|---|
OWNER TO | Change the owner of a procedure. |
RENAME TO | Change the name of a procedure. |
SET SCHEMA | Change the of a procedure. |
OWNER TO
ALTER PROCEDURE ... OWNER TO is used to change the owner of a procedure.
Required privileges
- To alter the owner of a procedure, the new owner must have on the schema of the procedure.
- To alter a procedure, a user must the procedure.
- To alter a procedure, a user must have on the schema of the procedure.
Parameters
| Parameter | Description |
|---|
role_spec | The role to set as the owner of the procedure. |
See Synopsis.
RENAME TO
ALTER PROCEDURE ... RENAME TO changes the name of a procedure.
Required privileges
- To alter a procedure, a user must the procedure.
- To alter a procedure, a user must have on the schema of the procedure.
Parameters
| Parameter | Description |
|---|
proc_new_name | The new name of the procedure. |
See Synopsis.
SET SCHEMA
ALTER PROCEDURE ... SET SCHEMA changes the of a procedure.
CockroachDB supports SET SCHEMA as an .
Required privileges
- To change the schema of a procedure, a user must have on the new schema.
- To alter a procedure, a user must the procedure.
- To alter a procedure, a user must have on the schema of the procedure.
Parameters
| Parameter | Description |
|---|
schema_name | The name of the new schema for the procedure. |
See Synopsis.
Examples
Rename a stored procedure
The following statement renames the to delete_histories:
ALTER PROCEDURE delete_earliest_histories RENAME TO delete_histories;
See also