Oracle sql updating multiple tables

tablespace_name, s.extent_management FROM user_tables t, user_tablespaces s WHERE t.tablespace_name = s.

Visit Stack Exchange Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Sign up to join this community CREATE TABLE one ( record_id SERIAL, one_first_var INTEGER, one_second_var INTEGER, one_third_var INTEGER ); INSERT INTO one (one_first_var, one_second_var, one_third_var) VALUES (1, 1, 1); INSERT INTO one (one_first_var, one_second_var, one_third_var) VALUES (2, 2, 2); INSERT INTO one (one_first_var, one_second_var, one_third_var) VALUES (3, 3, 3); CREATE TABLE two ( record_id SERIAL, two_first_var INTEGER, two_second_var INTEGER, two_third_var INTEGER ); INSERT INTO two (two_first_var, two_second_var, two_third_var) VALUES (21, 21, 21); INSERT INTO two (two_first_var, two_second_var, two_third_var) VALUES (22, 22, 22); INSERT INTO two (two_first_var, two_second_var, two_third_var) VALUES (23, 23, 23); WITH my_values AS ( SELECT one_first_var, one_second_var, one_third_var FROM one WHERE one_first_var = 2 ) UPDATE two SET two_first_var = my_values.one_first_var, two_second_var = my_values.one_second_var, two_third_var = my_values.one_third_var FROM my_values WHERE two_second_var = 22; UPDATE tgt SET Column1 = src.

This is one of the most interesting questions I keep on getting on this email and I find that not everyone knows about it. Our requirement is that we have Table2 which has two rows where Col1 is 21 and 31.

In recent times I have seen a developer writing a cursor to update a table. We want to update the value from Table2 to Table1 for the rows where Col1 is 21 and 31.

He has authored 11 SQL Server database books, 23 Pluralsight courses and has written over 4700 articles on the database technology on his blog at a https://blog.

Along with 16 years of hands on experience he holds a Masters of Science degree and a number of database certifications.

Search for oracle sql updating multiple tables:

oracle sql updating multiple tables-79oracle sql updating multiple tables-42oracle sql updating multiple tables-50

Thus, we need an update statement that is efficient.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “oracle sql updating multiple tables”

  1. Videos and chat are available along with correspondence. If you want to improve your odds it's time to start thinking outside the box. If you find Russian/Ukrainian ladies most appealing you will find thousands listed on the site.