The DELETE FROM statement lets you delete a specified row in any operation. In a searched operation, DELETE FROM deletes the row or rows that meet the specified criteria on a SELECT clause. In a cursor operation, DELETE FROM deletes the row currently being processed.
Important! If you use the DELETE FROM statement for a table, and you do not include a WHERE clause, all rows from the table are deleted. Use the DELETE FROM statement with extreme caution.
Consider the following information when you use the DELETE FROM statement:
Use this syntax in an AOF rule or an OPS/REXX program:
ADDRESS SQL "DELETE FROM keywords"
{tablename}
[WHERE searchcriteria]
[SYSTEM(ALL|EXT|sysnames)]
[SYSWAIT(seconds)]
[OUTPUT|NOOUTPUT]
[SYSPLEX]
Use this syntax to invoke the statement from a TSO terminal, a TSO/E REXX program, or a TSO CLIST:
OPSQL DELETE FROM {tablename}
[WHERE searchcriteria]
You may specify these operands for the DELETE FROM statement:
Defines the name of the table from which you want to delete rows.
(Optional) For a searched operation, the criteria on a WHERE clause can be any valid search criteria.
(Optional) For a cursor operation, the criteria on a WHERE clause must include CURRENT OF cursorname. The CURRENT OF cursorname causes the function to be performed on the row being processed in the cursorname operation. See the example that follows.
(Optional) Performs cross-system SQL operations. Specify one of these values:
Routes the SQL command to all active MSF-defined systems, including the local system.
Routes the SQL command to all remote, active MSF-defined systems.
Routes the SQL command to the specified systems. You may specify from one to eight system names as the value of sysnames.
Note: For more information about the SYSTEM operand, see the chapter “Using the Relational Data Framework” in the User Guide.
(Optional) Defines the number of seconds the SQL processor waits for output from a remote system.
Limits: 1-300 seconds
Note: Do not specify a value for SYSWAIT if you specify the SYSTEM(ALL), SYSTEM(EXT), or NOOUTPUT keywords.
(Optional) Indicates whether the command returns output to the external data queue. To return output, specify OUTPUT; otherwise, specify NOOUTPUT.
NOOUTPUT is implied when:
(Optional) Reduces the scope of the SYSTEM(ALL|EXT) operand to MSF connected systems that belong to the same z/OS sysplex as the command issuer. The keyword has no effect on a list of explicit system names.
(Optional) Performs SQL operations on other CA OPS/MVS subsystems that are in communication with the current one. Specify the following value:
Routes the SQL command to the specified subsystem. You can use only one four-character name of the subsystem as follows: OPSx.
Examples: DELETE FROM
These examples illustrate the use of the DELETE FROM statement:
Suppose that you want to delete from the SYSTEMS table all information associated with the CICS1 system. You can do this by invoking the following statement from OPS/REXX:
ADDRESS SQL "DELETE FROM SYSTEMS WHERE NAME = 'CICS1'"
To delete the current row being processed in a cursor operation named STATDOWN, issue this command from an AOF rule:
ADDRESS SQL "DELETE FROM APPLICATIONS WHERE CURRENT OF STATDOWN"
When you want to delete a relational table, you must first delete all of the rows in that table. You do this by invoking a DELETE FROM statement that omits the WHERE clause, as shown here:
ADDRESS SQL "DELETE FROM SYSTEMS"
Then, to remove the relational table from the DIV data set, invoke a DROP TABLE statement, which is described in the next section.
|
Copyright © 2014 CA Technologies.
All rights reserved.
|
|