6.17.8 Bulk UPDATE statement and Bulk DELETE statement

Update of multiple records in a batch is called bulk update. To perform bulk update, you use the Bulk UPDATE statement and Bulk DELETE statement. The bulk UPDATE and DELETE operations are applied to a stand-alone entity class or an entity class matching with the subclass. With the UPDATE statement, you define the identification variable in the UPDATE clause, and with the DELETE statement, you define the identification variable in the FROM clause and specify one type of entity.

Notes on using the Bulk UPDATE statement and Bulk DELETE statement:

An example of coding the Bulk UPDATE statement and Bulk DELETE statement is as follows:

UPDATE EMPLOYEE
SET MONTHLY_SALARY = MONTHLY_SALARY + 1000
WHERE DEPARTMENT_ID = 3

DELETE FROM EMPLOYEE e
WHERE e.EMPLOYEE_NAME IS NULL AND e.monthlySalary  IS EMPTY

For details on the syntax of the Bulk UPDATE statement and Bulk DELETE statement, see Appendix D BNF for JPQL.