Skip to Main Content

Write Great SQL Office Hours

Free tips and training every month! Subscribe for reminders and more from Office Hours. FAQ

Header container

June 15, 2021

13:00 UTC   Start Times Around the World

Subscribe to be notified of changes to sessions and give us feedback!

Having trouble watching the video on this page? Open the video in your browser.


All about update - Back to basics
To change values for existing rows, use UPDATE. In this back-to-basics session Chris will cover the ins-and-outs of doing this, including:

- How to write UPDATE
- Avoiding lost updates
- Getting the changed values
- Run UPDATE faster

Watch this Office Hours session to learn how UPDATE works.

Highlights of this session include:

00:55 - Structure of an update statement
03:00 - Record-based updated of all columns
05:55 - Update a query
07:00 - Demo of updating rows
08:00 - Demo of update blocking
09:20- Demo of record-based updates
11:30 - Demo of updating a query
16:45 - What is a lost update
19:30 - Avoiding lost updates with optimistic or pessimistic locking
21:45 - Pessimistic locking
25:45 - Optimistic locking
30:05 - Fetching updated values with the returning clause
31:10 - Demo of pessimistic locking
34:40 - Demo of optimistic locking
40:15 - Returning clause to get values from many updated rows
41:55 - How to update one table using values from another
45:55 - Update only merge
46:45 - "Update" using create-table-as-select
48:25 - dbms_redefinition.execute_update
48:50 - demo comparing performance of update methods
58:45 - Recap

Learn SQL for Free:

Your Experts

    Chris Saxon

    Chris Saxon   

    Chris Saxon is an Oracle Developer Advocate and quizmaster on Dev Gym. His job is to help you get the best out of the Oracle Database and have fun with SQL! He's also part of the answer team on Ask TOM and creates YouTube videos at The Magic of SQL channel.