Skip to main content
TopMiniSite

Back to all posts

How to Update A Column Using Select In Oracle?

Published on
4 min read
How to Update A Column Using Select In Oracle? image

Best Oracle SQL Guides to Buy in February 2026

1 Mastering Oracle SQL, 2nd Edition

Mastering Oracle SQL, 2nd Edition

  • AFFORDABLE: QUALITY BOOKS AT A FRACTION OF THEIR ORIGINAL PRICE!
  • ECO-FRIENDLY: SUPPORT SUSTAINABILITY BY CHOOSING PRE-LOVED BOOKS.
  • GREAT SELECTION: DIVERSE GENRES TO SATISFY EVERY READER'S TASTE!
BUY & SAVE
$21.76 $49.99
Save 56%
Mastering Oracle SQL, 2nd Edition
2 Oracle PL / SQL For Dummies

Oracle PL / SQL For Dummies

  • AFFORDABLE PRICES FOR QUALITY PRE-OWNED LITERATURE.
  • ECO-FRIENDLY CHOICE: SAVE TREES BY REUSING BOOKS.
  • UNIQUE FINDS: DISCOVER RARE TITLES AT GREAT DEALS!
BUY & SAVE
$15.77 $31.99
Save 51%
Oracle PL / SQL For Dummies
3 Oracle 12c: SQL

Oracle 12c: SQL

BUY & SAVE
$43.02 $128.95
Save 67%
Oracle 12c: SQL
4 Oracle Database 12c SQL

Oracle Database 12c SQL

  • QUALITY ASSURANCE: THOROUGHLY CHECKED FOR GOOD CONDITION AND READABILITY.
  • ECO-FRIENDLY CHOICE: PROMOTE SUSTAINABILITY WITH PRE-LOVED BOOKS.
  • AFFORDABLE PRICES: SAVE MONEY WHILE ENJOYING GREAT LITERATURE.
BUY & SAVE
$24.65 $66.00
Save 63%
Oracle Database 12c SQL
5 Oracle Database 11g SQL (Oracle Press)

Oracle Database 11g SQL (Oracle Press)

BUY & SAVE
$28.15 $65.00
Save 57%
Oracle Database 11g SQL (Oracle Press)
6 Practical Oracle SQL: Mastering the Full Power of Oracle Database

Practical Oracle SQL: Mastering the Full Power of Oracle Database

BUY & SAVE
$42.49 $54.99
Save 23%
Practical Oracle SQL: Mastering the Full Power of Oracle Database
7 Oracle SQL By Example

Oracle SQL By Example

BUY & SAVE
$69.99
Oracle SQL By Example
+
ONE MORE?

To update a column using select in Oracle, you can use a subquery in the UPDATE statement. You can select the values you want to update the column with in the subquery, and then use that subquery in the SET clause of the UPDATE statement. This will allow you to update the column based on the results of the select query. Make sure the subquery returns only one value for each row that you want to update, otherwise you may encounter errors.

How to update a column using select in Oracle?

To update a column using a select statement in Oracle, you can use the following query:

UPDATE table_name SET column_name = (SELECT new_value FROM other_table WHERE condition) WHERE condition;

In this query:

  • table_name is the name of the table you want to update.
  • column_name is the name of the column you want to update.
  • new_value is the value you want to set in the column.
  • other_table is the table from which you want to select the new value.
  • condition is the condition that defines which rows will be updated.

Make sure that the subquery (SELECT new_value FROM other_table WHERE condition) returns only one value, otherwise the query will throw an error. Also, ensure that the WHERE clause in the outer query specifies the correct conditions to update the desired rows.

How to update a column in a specific order using select in Oracle?

To update a column in a specific order using SELECT in Oracle, you can follow these steps:

  1. Use a subquery to create a temporary table that includes the rows you want to update in the desired order.
  2. Add a column to the temporary table that contains the updated values.
  3. Use an UPDATE statement to update the original table based on the values in the temporary table.

Here is an example:

-- Create a temporary table with the desired order WITH temp_table AS ( SELECT column1, column2, row_number() OVER (ORDER BY column1) as rn FROM your_table ) -- Update the column in the original table based on the values in the temporary table UPDATE your_table t SET t.column_to_update = ( SELECT tt.updated_value FROM ( SELECT column1, column2, updated_value FROM temp_table ) tt WHERE t.column1 = tt.column1 ) WHERE EXISTS ( SELECT 1 FROM temp_table WHERE t.column1 = temp_table.column1 );

In this example, replace your_table with the name of the table you want to update, column_to_update with the name of the column you want to update, and column1 with the column you want to use for ordering. The updated_value column should contain the new values for the column you are updating.

By using a subquery and a temporary table with a row number function, you can update the column in the specific order you want.

What is the impact on triggers when updating a column in Oracle?

When updating a column in Oracle, triggers associated with that column may be fired depending on the type of trigger and its defined conditions.

  1. Before Update Triggers: If there is a "before update" trigger defined on the table that includes the column being updated, the trigger will be fired before the actual update takes place. This allows the trigger to perform any necessary actions or validations before the update is applied.
  2. After Update Triggers: If there is an "after update" trigger defined on the table that includes the column being updated, the trigger will be fired after the update has taken place. This allows the trigger to perform any post-update actions or logging.
  3. Instead of Update Triggers: If there is an "instead of update" trigger defined on the table that includes the column being updated, the trigger will be fired instead of the actual update operation. This type of trigger can be used to completely replace the update operation with custom logic.

In conclusion, updating a column in Oracle can trigger associated triggers, which can impact the data being updated and perform additional logic or actions before or after the update operation.