Introduction to DB2 for z/OS
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Update statements

Introduction to DB2 for z/OS

You can change the data in a table by using the UPDATE statement or the MERGE statement.

Start of changeThe UPDATE statement modifies zero or more rows of a table, depending on how many rows satisfy the search condition that you specify in the WHERE clause.End of change

Start of changeYou can use an UPDATE or MERGE statement to specify the values that are to be updated in a single row. You can specify constants, host variables, expressions, DEFAULT, or NULL. Specify NULL to remove a value from a row's column (without removing the row).End of change

Suppose that an employee gets a promotion. To update several items of the employee's data in the NEWEMP table that reflects the move, use this UPDATE statement:

UPDATE NEWEMP
  SET JOB = 'MGR',
  DEPT = 'E21'
  WHERE EMPNO = '100125'; 




Copyright IBM Corporation 1990, 2010