Switch to: V12V11V10V9V8V7V6V5

Table of Contents


Updates the values of one or several table fields at the chosen records.


		: UPDATE table_name SET set_clause [ , set_clause ... ]  
		  [ WHERE search_condition ]

		: column_name = < DEFAULT | NULL | expr >

The WHERE statement chooses the records which are to be updated. If WHERE is not defined, all the table records will be updated.

SET operator defines which fields could be updated and defines new values for them, and is the operation list of the assignment statements which are separated by a comma from one another. In each statement, the object field which is updated is identifying and new value for this field is defined. Each object field should be mentioned in the list only once; also it shouldn’t be to assignment statements for the same object field.


UPDATE tbl1 
SET fldLong = 1100  
WHERE fldLong  > 1000

SQL Binding

UPDATE command supports SQL binding of parameters. It means that together with the query programmer sends the array of the records with the value representation. From the array, you can refer with the help of the index using the syntax: :N.

Some advantages of linkage usage:

  1. you don’t waste CPU time for the unprintable characters’ allocation inside the string (escape quotes);.
  2. you don’t waste CPU time for the building of string query using concatenation, instead you get the fixed query form and just update the values in the linked array.
  3. SQL parser gets a string query in shorter form and thus spends less CPU time for the analyze.
  4. you can link BLOB values AS IS.

Example: of parameters binding

stmt = db.CreateStatement( "UPDATE person SET name = :1, f2 = :2" ) 
stmt.Bind_string( "john" )