Αποτελέσματα Αναζήτησης
If you want to update specific rows (ie where the IDs match) you probably want to do a coordinated subquery. However, since you are using Oracle, it might be easier to create a materialized view for your query table and let Oracle's transaction mechanism handle the details.
6 Δεκ 2017 · Learn about several methods to update data using subqueries in UPDATE statements to make them more effective and easier to maintain in Oracle SQL.
Subquery Method. The first option is to do an update of the DEST_TAB table using a subquery to pull the correct data from the SOURCE_TAB table. Notice the EXISTS predicate to exclude rows from the DEST_TAB table with no matching row in the SOURCE_TAB table.
An example of using a sub query to update a record is illustrated by the following diagram: UPDATE product_obj_table p1 SET package_id = (SELECT REF(p2) FROM product_obj_table p2 WHERE product_id = 14) WHERE product_id = 22; The UPDATE statement ; SET package_id =SELECT; FROM product_obj_table; WHERE product_id =14; WHERE product_id=22
30 Μαΐ 2011 · From Oracle Database 23ai you can use direct joins in update to copy values from one table to another:
Update using correlated subquery. This statement uses a correlated subquery to update a single column across multiple rows in the FLIGHTS table. It increases the duration of all BA flights by thirty minutes. The subquery returns all flights with OPERATING_CARRIER_CODE set to 'BA'. This result is used as the predicate value in the UPDATE statement.
Introduction to the Oracle subquery. A subquery is a SELECT statement nested inside another statement such as SELECT, INSERT, UPDATE, or DELETE. Typically, you can use a subquery anywhere that you use an expression. Consider this following subquery example that uses the products table from the sample database.