IBM Tivoli Netcool/OMNIbus, Version 7.4

Deleting rows of data from a table (DELETE command)

Use the DELETE command to delete one or more rows of data from an existing table.

Syntax

DELETE FROM [database_name.]object_name
 [ VIA value_of_primary_key_column,... ]
 [ WHERE condition ];

Using the WHERE clause

If you include a WHERE clause, only rows meeting the criteria specified in the condition are updated. If no condition is specified in the WHERE clause, all rows are updated.

The WHERE clause can perform the same functions that the VIA clause does in earlier versions of Tivoli Netcool/OMNIbus. If the primary key is specified in the WHERE clause, the ObjectServer will not perform a full table scan but will instead directly access rows using the primary key.

The following example removes all the rows of the alerts.status table where the value of the Node field is equal to Fred:
delete from alerts.status where Node = 'Fred';

Using the VIA clause

The VIA clause was deprecated with Tivoli Netcool/OMNIbus V7.2 but it is still valid. Its functions can now be performed by the WHERE clause.

If you know the value of the primary key for the row that you want to delete, you can specify the value using the VIA clause. If there is more than one primary key column, the values must be specified in order and separated by commas (,). String values must be enclosed in single quotes (’).

If multiple rows are being updated, the primary key(s) for each row must be enclosed in square brackets ([ ]) and separated by commas (,).

The VIA clause can be useful for documenting your SQL. For example, it can be used to let the maintainer of triggers know that the DELETE is being performed using primary keys.

The following example shows how to delete multiple primary keys using the DELETE VIA command:
delete from alerts.status via ['722Identifier722'],['294Identifier294'];