Altering stored procedures
The process that you follow to alter a stored procedure depends on the type of stored procedure and how you want to alter it.
About this task
You can alter stored procedures in the following ways:
- For a native SQL procedure, you can alter the options and the body, and you can manage multiple versions.
- For an external stored procedure (a procedure that is written in a host language), you can alter the procedure options. If you change the host language code, you need to prepare the code again (compile, link-edit, bind, …).
- For an external SQL procedure, you can alter only the options.Deprecated function: External SQL procedures are deprecated and not as fully supported as native SQL procedures. For best results, create native SQL procedures instead. For more information, see Creating native SQL procedures and Migrating an external SQL procedure to a native SQL procedure.
Procedure
To alter an existing stored procedure:
Examples
- Example 1: changing the WLM environment
- The following example changes the external stored procedure SYSPROC.MYPROC to run in the WLM environment PARTSEC:
ALTER PROCEDURE SYSPROC.MYPROC WLM ENVIRONMENT PARTSEC;
- Example 2: changing the stored procedure to use another authorization ID
-
Assume that you defined the stored procedure SYSPROC.MYPROC with the SECURITY DEFINER option. When you specify the SECURITY DEFINER option, the external security environment for the stored procedure uses the authorization ID of the owner of the stored procedure to control access to non-SQL resources. The following example changes the stored procedure SYSPROC.MYPROC so that it uses the authorization ID of the person who is running the stored procedure to control access to non-SQL resources:
ALTER PROCEDURE SYSPROC.MYPROC SECURITY USER;