ACTION bind option

The ACTION option determines whether the object (plan or package) replaces an existing object with the same name or is new.

Command option Option values Used with
ACTION
  • (REPLACE)
  • (REPLACE) REPLVER 1
  • (REPLACE) RETAIN 2
  • (ADD)
Note:
  1. The REPLVER keyword is valid only for BIND PACKAGE.
  2. The RETAIN keyword is valid only for BIND PLAN.

Option descriptions for ACTION

ACTION(REPLACE)
The object replaces an existing one with the same identifier, and a new entry replaces the old one in the catalog table SYSPLAN or SYSPACKAGE. If no object with the given identifier already exists, the bind process creates the new object and a new entry.

The authorization ID designated explicitly or implicitly by the option OWNER becomes the owner of the new object. If that authorization ID is not the previous owner, all grants of privileges for the object that the previous owner issued change to name the new owner as the grantor.

If the bind fails, the old object and its entry remain.

For BIND PACKAGE: You cannot use REPLACE with a remote package bound with either of the options ENABLE or DISABLE. The attempt causes the bind to fail.

REPLVER (version-id) (For BIND PACKAGE only)
Replaces a specific version of the package, identified by version-id. If the package with the specified version-id does not exist, the bind fails.

Start of changeversion-id is an undelimited identifier. Db2 does not convert the value to uppercase or change it in any other way.End of change

The default for version-id comes from the DBRM if you use the MEMBER option on BIND, or from the COPYVER option if you use the COPY option.

RETAIN (For BIND PLAN only)
Preserves EXECUTE privileges when you replace the plan. If ownership of the plan changes, the new owner grants the privileges BIND and EXECUTE to the previous owner.

RETAIN is not the default. If you do not specify .RETAIN, everyone but the plan owner loses the EXECUTE privilege (but not the BIND privilege). If plan ownership changes, the new owner grants the BIND privilege to the previous owner.

ACTION(ADD)
Adds a new object, but does not replace an existing one. If the object name already exists in the catalog, the bind fails. If the bind fails for any reason, the bind process does not produce a new package or plan and makes no entry in the catalog.
Replacing a version of a package (REPLVER): ACTION(REPLACE) REPLVER can have different effects, depending on the situation. For example, assume that DBRM1 is the name of the member that contains the DBRM for the package, and that A and B are the names of two versions of the package. Suppose that you bind version A with the following command:
BIND PACKAGE(COLL1) MEMBER(DBRM1) ACTION(REPLACE) REPLVER(B)
  • If neither DBRM1, version A, nor version B exist in the Db2 catalog, the command fails because version B is not in the catalog. No new package is added.
  • If DBRM1 and version B, but not version A, exist in the Db2 catalog, then version A replaces version B. As a result, version A exists in the catalog, and version B no longer exists in the catalog.
  • If DBRM1 and version A exist in the catalog, but not version B, the command fails because version B is not in the catalog. Version A continues to exist.
  • If DBRM1 and both versions A and B exist in the catalog, the command fails because version A already exists.

Default values for ACTION

Process Default value
BIND SERVICE ADD
BIND PLAN REPLACE
BIND PACKAGE REPLACE
REBIND PLAN REPLACE
REBIND PACKAGE N/A

Catalog records for ACTION

See the SYSPLAN or SYSPACKAGE catalog tables.