Using the COPY command
This procedure describes how to use the COPY command during a data editing session. This is efficient if you need to make several changes to the initial SELECT statement or need to update the retrieved rows before committing the copy action.
- Invoke a data editing session for the target table or view. For information, see Methods-for-invoking-the-data-editing-function.
On the Edit DB2 Table Options panel, set option values for editing data. For information, see Setting-options-for-editing-data.
- Press Enter.One of the following panels is displayed:
- If another user has begun an editing session in the table or view, the Other Users Editing This Table panel is displayed. To edit the table or view, press Enter. To display the Edit DB2 Table Options panel, press END or CANCEL.
- If no other users are editing the table, the Edit DB2 Table panel is displayed.
- On the Command line, type COPY.
Press Enter.The COPY From DB2 Table Options panel is displayed below:
DEFF-R ----------------- COPY From DB2 Table Options -----------------------
Command ===>
Specify the following options, then press ENTER to read table rows.
Press END or CANCEL to abandon the copy.
Copy source table . . . . . . QZU.QZUT01_DCII9S05
Edit COPY select statement . . Y Display and edit copy select statement.
Save/Retrieve Select . . . . . N (S/R/N) N-no action
S-save current select statement in SQL
table using the select statement name
R-retrieve list of saved select statements
matching pattern in select statement name
Select statement name . . . .
Number of rows to Copy . . . . 0 0-99999999 rows to copy. 0 = no limit.
Approximate upper limit is shown.Set options for specifying the source table or view and for customizing the SELECT statement that Catalog Manager creates to perform the copy.To specify the source table or view, you can use the following methods:
- Type the name of a table or view.
- Type a pattern that includes a wildcard. For more information about using wildcards, see Supported-wildcards-in-qualifiers.
- Retrieve a saved SELECT statement from the SQL_Table by typing Y in the Save/Retrieve Select field. This option also enables you to save the SELECT statement that Catalog Manager creates for the current copy action.
In above figure, the following options have been selected:
- To copy from the source table
- To edit the SELECT statement
- To copy all applicable rows
Press Enter.The Select Statement Specification panel is displayed below:
DEFF ------------------ Select Statement Specification ---------------------
Command ===> Scroll ===> CSR
Select columns to edit and type where clause values, then press ENTER
S NAME TYPE LENGTH ORDER OPER VALUE
S COLUMN_1 INTEGER 4 A =
S COLUMN_2 SMALLINT 2 A =
S COLUMN_3 CHAR 12 A =
S COLUMN_4 CHAR 7 A =
S COLUMN_5 CHAR 4 A =
S COLUMN_6 VARCHAR 55 A =
S COLUMN_7 DECIMAL 31,20 A =
S COLUMN_8 DECIMAL 11,2 A =
S COLUMN_9 SMALLINT 2 A =
S COLUMN_10 INTEGER 4 A =
S COLUMN_11 FLOAT 4 A =
S COLUMN_12 FLOAT 8 A =
S COLUMN_13 DATE 4 A =
S COLUMN_14 TIME 3 A =
S COLUMN_15 TIMESTMP 10 A =
S COLUMN_16 VARCHAR 30 A =
S COLUMN_17 INTEGER 4 A =
S COLUMN_18 CHAR 20 A =
S COLUMN_19 CHAR 24 A =
S COLUMN_20 INTEGER 4 A > 20Customize the SELECT statement by modifying the selected columns and values on the panel. Press HELP to display example specifications.
- Press END.The COPY From DB2 Table Options panel is displayed. You can specify whether to change other options on the panel.
When you have determined the options to use for the SELECT statement, press Enter.The Edit DB2 Table panel is displayed to show you the rows that have been copied.
DEFF -------------------------- Edit DB2 Table -----------------------------
Command ===> Scroll ===> CSR
QZU.QZUT01_DCII9S05 (301/2288)
****** COLUMN_1 COLUMN_2 COLUMN_3 COLUMN_4 COLUMN_5 COLUMN_6
*INS 1818599 0 AABN0000467 1124064 4064 'DEFENDANT ARRAIGN
*INS 1818629 7364 AABN0000478 1130064 0064 'DEFENDANT ARRAIGN
*INS 1818687 26700 AABN0000495 1139064 9064 'DEFENDANT ARRAIGN
*INS 1818706 -20104 AABN0000501 1141064 1064 'DEFENDANT ARRAIGN
*INS 1818722 27713 AABN0000506 1145064 5064 'DEFENDANT ARRAIGN
*INS 1818733 -14913 AABN0000510 1146063 6063 'DEFENDANT ARRAIGN
*INS 1818754 7200 AABN0000517 1148064 8064 'DEFENDANT ARRAIGN
*INS 1818758 16000 AABN0000519 1148064 8064 'DEFENDANT ARRAIGN
*INS 1818781 7300 AABN0000525 1160064 0064 'DEFENDANT ARRAIGN
*INS 1818810 3300 AABN0000536 1164064 4064 'DEFENDANT ARRAIGN
*INS 1818836 6800 AABN0000543 1171064 1064 'DEFENDANT ARRAIGN
*INS 1818895 0 AABN0000561 1176064 6064 'DEFENDANT ARRAIGN
*INS 1818902 0 AABN0000562 1177064 7064 'DEFENDANT ARRAIGN
*INS 1818932 4275 AABN0000573 1182064 2064 'DEFENDANT ARRAIGN
*INS 1818944 0 AABN0000577 1184064 4064 'DEFENDANT ARRAIGN
*INS 1818954 5985 AABN0000578 1185064 5064 'DEFENDANT ARRAIGN
*INS 1447973 18000 AABN0000585 1655233 5233 'DEFENDANT ARRAIGN
*INS 1819036 0 AABN0000600 1209064 9064 'DEFENDANT ARRAIGN
*INS 1448522 0 AABN0000603 0773625 3625 'DEFENDANT ARRAIGN
*INS 1448585 -31536 AABN0000612 0774002 4002 'DEFENDANT ARRAIGN- Press END to display the Edit DB2 Table Options panel. Catalog Manager displays the CHANGES COMMITTED message to confirm the COPY action.
Related topic