The payment transaction reads and updates the customer. The customer may either be identified by its last name or its C_ID. In the case the last name this chooses the middle row of the set of customers sharing the same last name, ordered by first name. Note the select count and the cursor.

The transaction profile does not offer possibilities of optimization.