Modifies a procedure.
ALTER PROCEDURE [ owner.]procedure-name procedure-definition
procedure-definition : see the CREATE PROCEDURE statement
ALTER PROCEDURE [ owner.]procedure-name SET HIDDEN
ALTER PROCEDURE [ owner.]procedure-name RECOMPILE
The ALTER PROCEDURE statement must include the entire new procedure. You can use PROC as a synonym for PROCEDURE.
The ALTER PROCEDURE statement is identical in syntax to the CREATE PROCEDURE statement except for the first word. Both Watcom and Transact-SQL dialect procedures can be altered through the use of ALTER PROCEDURE.
With ALTER PROCEDURE, existing privileges on the procedure are not changed. If you execute DROP PROCEDURE followed by CREATE PROCEDURE, execute privileges are reassigned.
Use SET HIDDEN to obfuscate the definition of the associated procedure and cause it to become unreadable. The procedure can be unloaded and reloaded into other databases.
If SET HIDDEN is used, debugging using the debugger does not show the procedure definition, and the definition is not available through procedure profiling.
Use the RECOMPILE syntax to recompile a stored procedure. When you recompile a procedure, the definition stored in the catalog is re-parsed and the syntax is verified. For procedures that generate a result set but do not include a RESULT clause, the database server attempts to determine the result set characteristics for the procedure and stores the information in the catalog. This can be useful if a table referenced by the procedure has been altered to add, remove, or rename columns since the procedure was created.
The procedure definition is not changed by recompiling. You can recompile procedures with definitions hidden with the SET HIDDEN clause, but their definitions remain hidden.
You must be the owner of the procedure or have one of the following privileges:
Automatic commit.
ALTER PROCEDURE is optional ANSI/ISO SQL Language Feature F381. However, in the SQL standard, ALTER PROCEDURE cannot be used to re-define a stored procedure definition, and Transact-SQL dialect procedures are not supported. The ANSI/ISO SQL Standard does not include support for SET HIDDEN or RECOMPILE.
The following example creates and then alters a procedure using a variable in the NAMESPACE clause
The following statements create a variable for a NAMESPACE clause:
CREATE VARIABLE @ns LONG VARCHAR SET @ns = 'http://wsdl.domain.com/';
The following statement creates a procedure named FtoC that uses a variable in the NAMESPACE clause:
CREATE PROCEDURE FtoC ( IN temperature LONG VARCHAR ) URL 'http://localhost:8082/FtoCService' TYPE 'SOAP:DOC' NAMESPACE @ns;
The following statement alters the procedure FtoC so that the temperature parameter accepts a FLOAT data type:
ALTER PROCEDURE FtoC ( IN temperature FLOAT ) URL 'http://localhost:8082/FtoCService' NAMESPACE @ns;