ddtek:sql-update


This built-in function updates records in a database table.

The syntax is:

declare updating function ddtek:sql-update( 
    row as element()*, 
    column as xs:string, 
    value as item()*, 
    ...) external; 

where:

row identifies the records in the database table to update. Each item in the sequence must be a row element of the database table returned by a previous fn:collection() call.

column is the column of the database table to update.

value is the new value for the specified column.

column and value are a pair in a variable argument list. If column is specified without value, an error is raised.

The following example updates a record in the holdings table, the record where the userid column equals Minollo and the stockticker column equals PRGS. In this record, the shares column is updated to 500.

ddtek:sql-update( 
  collection("holdings")/holdings[userid="Minollo" and stockticker="PRGS"], 
  "shares", 500) 

Other examples can be found in the RDBMSUpdate example.