Deletion of records in tables. Returns the number of deleted registers.

1 delete

    <where> !
        <condition /> !
    <where-current-of /> ?


database required

The database is not informed.

The specified table is not in the database.

The tables does not exists.

required attribute [...]

A required attribute has not been informed.


To remove registers of a table is necessary to indicate the database with the parameter "-dbms" and the user with the parameter "-user".

If you want to delete registers without any condition, you should create a condition which is met for all the registers, for example, 1 = 1.

If you use where-current-of, the select should carry the attribute for-update='yes' to indicate that the cursor is will not only be read but will be modified. It is also necessary to open transaction before the foreach.


Remove registers.

<xsql-script name='delete_sample1'>
        <set name='cenllote_loteid'>136</set>
        <delete table='nombre de tabla'>
            <where>loteid = <cenllote_loteid/></where>

The registers are remove of the table "ccon_interfase" whose value of the column loteid coincide with the content of the variable cenllote_loteid.


Example of use of the tag 'where-current-of': all the registers of the table 'cdiary' is deleted.

<xsql-script name='delete_sample2'>
       <!-- It is necessary to open transaction. -->
       <connection.begin />
           <!-- You should indicate to the cursor that it will be modified. -->
           <select for-update='yes'>
               <from table='cdiary' />
               <delete table='cdiary'>
                   <where-current-of />
       <connection.commit />