REMOVE ALL

Previous Next

REMOVE ALL clauses in the USoft Rule Language serve to identify the table deleted from. They are the equivalent of SQL DELETE clauses. The SQL conditions that identify the records to be deleted (the "WHERE clauses") are introduced by FOR WHICH.

REMOVE ALL clauses are only used in constraint SQL that (potentially) DELETEs data.

Syntax

REMOVE ALL   single-string-object-name-plural   table-alias

where the required and case-insensitive single-string-object-name-plural is the same or similar to the Object Name Plural value for the table as defined in USoft Definer:

If the Object Name Plural value does NOT contain a space, it is equivalent to the Object Name Plural value, whether surrounded by optional double quotes or not;

If the Object Name Plural DOES contain one or more spaces, you must surround single-string-object-name-plural by double quotes.

For example, if you have a table BANK_ACCOUNT with Object Name Plural = Bank Accounts, the single-string-object-name-plural is:

"Bank Accounts"

and the following are legal variants:

"bank accounts"

"BANK ACCOUNTS"

Examples

USoft Rule Language

SQL Equivalent

REMOVE ALL      drivers
FOR WHICH       age < 23

DELETE FROM    driver
WHERE          age < 23

With a subquery:

USoft Rule Language

SQL Equivalent

REMOVE ALL      drivers d
FOR WHICH exists
(
   SELECT      ''
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE       b.id = d.id
   AND         c.paid = 'N'
)

DELETE FROM      driver d
WHERE EXISTS
(
   SELECT        ''
   FROM          contract c
   ,             business_party b
   RELATE        b "PAYS FOR" c
   WHERE         b.id = d.id
   AND           c.paid = 'N'
)