<condition /> !
<where-current-of /> ?
|Asecure||boolean||True to enhire the security of the role of the BD connection group to which the user belongs. This flag is always true if the select is being executed from dbconmgr or soap call with embebed xsql code (non-catalog).|
|Atable||string||Name of the table.|
|Ewhere||null||Condition of selection for the registers which should be removed. It is mandatory, so if you want to remove all the registers of the table, it should be used the condition 1 = 1.|
|Ewhere-current-of||null||Replace the 'where'. In a foreach, it referes in each round to the register which is being traited in this moment.|
|integer||Number of deleted registers.|
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.
<xsql-script name='delete_sample1'> <body> <set name='cenllote_loteid'>136</set> <delete table='nombre de tabla'> <where>loteid = <cenllote_loteid/></where> </delete> </body> </xsql-script>
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'> <body> <!-- It is necessary to open transaction. --> <connection.begin /> <foreach> <!-- You should indicate to the cursor that it will be modified. --> <select for-update='yes'> <columns>*</columns> <from table='cdiary' /> </select> <do> <delete table='cdiary'> <where-current-of /> </delete> </do> </foreach> <connection.commit /> </body> </xsql-script>