Αποτελέσματα Αναζήτησης
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.
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.
15 Μαρ 2010 · 16 Answers. Sorted by: 528. That syntax isn't valid in Oracle. You can do this: UPDATE table1 SET table1.value = (SELECT table2.CODE. FROM table2 . WHERE table1.value = table2.DESC) WHERE table1.UPDATETYPE='blah'
4 Αυγ 2023 · Direct join syntax is unsupported in Oracle Database; use a correlated subquery to fetch the values instead. For example: update nashvillehousing a set propertyaddress = ( select nvl2(a.propertyaddress, b.propertyaddress,b.propertyaddress) from nashvillehousing b where a.parcelid = b.parcelid and a.uniqueid_ != b.uniqueid_ ) where a ...
You may use subqueries in place of tables in this way as well in INSERT, UPDATE, and DELETE statements. Subqueries so used can employ correlation variables, both defined within the subquery itself and those defined in query blocks containing the subquery.
30 Μαΐ 2011 · From Oracle Database 23ai you can use direct joins in update to copy values from one table to another:
table | view | materialized_view | subquery. Specify the name of the table, view, materialized view, or the columns returned by a subquery to be updated. Issuing an UPDATE statement against a table fires any UPDATE triggers associated with the table. If you specify view, then the database updates the base table of the view.