OSQL DELETE Command

PURPOSE:  This statement removes one or more rows of data from the specified table.  Rows may be deleted from one table based on values in other tables.

If the WHERE clause is not specified, the entire table is cleared as is done for an ICL CLEAR DS command.

Syntax

OSQL DELETE  /FROM/ table_name
[WHERE str_exp]
[DEFINE PM process_module_name [ONLY]]

table_name

is the name of the table from which you want to remove rows.

WHERE str_exp

You can set the string to any value that yields a valid WHERE clause including column names, expressions, arithmetic operators, comparison operators, the keywords NOT, LIKE, IS NULL, AND, OR, BETWEEN, IN, EXISTS, ANY, ALL, sub-queries, or any combination of these items.  There is no limit on the number of search conditions that can be included.  This search condition cannot contain aggregates.  See the ‘WHERE clause’ in the Oracle SQL Language Reference Manual.  Note all literals must be enclosed within single quote marks (i.e. '  ').

DEFINE PM process_module_name

specifies that the process module containing the code generated to execute the OSQL command be saved and named as an object in the current DBL.  This process module is made up of ACCENT R SPL and SMF statements and is useful for prototyping applications.  Defining the Process Module causes your OSQL command to be compiled for faster execution.

ONLY

specifies that the Process Module will be created without being executed by OSQL.  This clause is used primarily by the OSQL BUILD command but may also be used for on-line prototyping.  If you include the ONLY clause then you must invoke the Process Module interactively.

Example

*OSQL DELETE FROM BOOKS_ORA WHERE BOOKS_ORA.TYPE_CODE = 'for_lang'

SEE ALSO:  SQL DELETE statement

OSQL Create DS Command    OSQL Edit Command