Reference Guide > TDV SQL Script > SQL Script Statement Reference > UPDATE
 
UPDATE
An UPDATE statement in SQL Script updates records in a table.
Syntax
UPDATE <table>
SET <column> = <valueExpression> [, <column> = <valueExpression>]*
[WHERE <conditionalExpression>]
Remarks
Any UPDATE statement that the system accepts can be used as a standalone SQL Script statement.
Variables are allowed in a SQL statement anywhere a literal is allowed.
The WHERE clause is optional. The rules for the WHERE clause of an UPDATE statement is the same as the rules for WHERE clause of a SELECT statement.
The following subqueries in the SET clause are not allowed:
UPDATE <table1> SET x = (SELECT y FROM <table2>)
Examples
PROCEDURE p ( )
BEGIN
  DELETE FROM /shared/scores;
  INSERT INTO /shared/scores VALUES ('Joe', 1001);
  UPDATE /shared/.scores SET score=1239 WHERE name='Sue';
END
 
PROCEDURE p (IN p_name VARCHAR, IN new_score)
BEGIN
  DELETE FROM /shared/scores WHERE name=p_name;
  INSERT INTO /shared/scores VALUES (p_name, new_score);
  UPDATE /shared/.scores SET score=new_score WHERE name=p_name;
END