COPY bind option
The COPY option copies an existing package, and names that package.
COPY |
|
On: BIND PACKAGE |
Copying the package recalculates the access paths in the copy.
- collection-id
- The name of the collection that contains the package to copy, as listed in column COLLID of catalog table SYSPACKAGE.
- package-id
- The name of the package to copy, as listed in column NAME of catalog table SYSPACKAGE.
- COPYVER(version-id)
- Determines the version of the package to copy. The default for version-id is the empty string.
- collection-id.package-id must identify a package on the local server.
- You cannot copy to a package in the same collection. If you make the copy on the local server, collection-id. on the COPY option must not name the collection used on the PACKAGE option.
- DB2® uses the ISO format for output values unless the SQL statement explicitly specifies a different format. Input values can be specified in one of the standard formats, or in a format that is recognized by the server's local date/time exit.
Process | Default value |
---|---|
BIND PLAN | N/A |
BIND PACKAGE | None |
REBIND PLAN | N/A |
REBIND PACKAGE | N/A |
COPY has no default. If you do not use COPY, you must use MEMBER. You cannot use both options.
The option values of the package copied (except the values of ENABLE, DISABLE, OWNER, and QUALIFIER) become the defaults for binding the new package. You can override a default by choosing a new value for an option on the BIND PACKAGE command.
Copy packages to remote servers: To copy and bind packages from DB2 10 for z/OS® to some other server that does not support all the new BIND options in DB2 10, use the OPTIONS(COMMAND) option on BIND PACKAGE COPY. Any options you do not explicitly specify on the BIND PACKAGE subcommand are set to the server's defaults. Using this option can prevent bind errors when you bind and copy packages to servers other than DB2 10 for z/OS.
- Target location as the target site on the CONNECT/implicit DRDA SQL
- Collection ID as the native SQL procedure's schema
- Package ID as the native SQL procedure's name
- COPYVER as the native SQL procedure's version
CREATE PROCEDURE TEST.MYPROC LANGUAGE SQL VERSION ABC ...
BEGIN
...
CONNECT TO SAN_JOSE
...
END
BIND PACKAGE(SAN_JOSE.TEST) COPY(TEST.MYPROC) COPYVER(ABC) ACTION(ADD)
- Target collection ID as the target of the SQL statements
- Source collection ID as the native SQL procedure's schema
- Package ID as the native SQL procedure's name
- COPYVER as the native SQL procedure's version
CREATE PROCEDURE TEST.MYPROC LANGUAGE SQL VERSION ABC ...
BEGIN
...
SET CURRENT PACKAGESET = 'COLL2'
...
END
BIND PACKAGE(COLL2) COPY(TEST.MYPROC) COPYVER(ABC)
ACTION(ADD) QUALIFIER(XYZ)
If you need to create a new copy because the native SQL procedure has changed and requires a regeneration, use the BIND COPY ACTION(REPLACE) command.
Catalog record: Column COPY of table SYSPACKAGE.