Derby: UPDATE FROM SELECT

Derby doesn’t support the MS proprietary UPDATE FROM SELECT, nor does it support the SQL standard MERGE
so I had to write the following script to update a table from values retrieved from a select.
It uses a temporary table and a subquery in the SET clause. I had to add an index to the temporary table to speed up things: