Allows to modify registers of a table. Returns the number of modified registers.

1 update

    <ids-directive> ?
        <value /> +
    <oracle-directive> ?
        <value /> +
    <db2u-directive> ?
        <value /> +
    <db2i-directive> ?
        <value /> +
    <mysql-directive> ?
        <value /> +
    <sqlserver-directive> ?
        <value /> +
    <postgres-directive> ?
        <value /> +
    <column text='text'> +
        <value /> !
    <where> ?
        <condition /> !
    <where-current-of /> ?
    <values> ?
        <value /> !


database required

You need to specify the database.

The specified table is not in the database.

The tables does not exist.

required attribute [...]

A required attribute has not been informed.

no columns specified in update comman

The columns has not been specified.


To modify registers is necessary that the user will be identified and that you select a database. This is informed through the options -user and -dbms of the command ws-dbscript.

If where-current-of is used, the select must bring the attribute for-update='yes' to indicate that the cursor will not be only-read but it can be modified. Also it is necessary to open transaction before the foreach.


Modify registers of a table.

<xsql-script name='update_sample1'>
        <set name='cenllote_loteid'>136</set>
        <update table='ccon_interfase'>
            <column name='codemp'>23</column>
            <where>loteid = <cenllote_loteid/></where>

Example of use of the tag 'where-current-of': in all the registers of the table 'cdiary' you should put the field 'nomdia' in capital letters.

<xsql-script name='update_sample2'>
       <!-- It is necessary to open transaction. -->
       <connection.begin />
           <!-- You shouyld indicate to the cursor that it will be modified. -->
           <select for-update='yes'>
               <from table='cdiary' />

               <update table='cdiary'>
                   <column name='nomdia' text='true'>UPPER(nomdia)</column>
                   <where-current-of />
       <connection.commit />

Update with optimization for the ids.

       <update table='gdwh_ctersecs'><ids-directive>--+INDEX(gdwh_ctersecs, "i_gdwh_ctersecs1")</ids-directive>
           <column name='canmov'>canmov + p_canmov</column>