Skip to main content
The ALTER PROCEDURE modifies a .

Required privileges

Refer to the respective subcommands.

Synopsis

alter_proc syntax diagram

Parameters

ParameterDescription
proc\_nameThe name of the procedure to alter.
routine\_paramAn optional list of procedure parameters.

Subcommands

SubcommandDescription
OWNER TOChange the owner of a procedure.
RENAME TOChange the name of a procedure.
SET SCHEMAChange 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

ParameterDescription
role\_specThe 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

ParameterDescription
proc\_new\_nameThe 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

ParameterDescription
schema\_nameThe name of the new schema for the procedure.
See Synopsis.

Examples

Rename a stored procedure

The following statement renames the to delete_histories:

See also