How to update two tables using single procedure in oracle?

by darrion.kuhn , in category: MySQL , 2 months ago

How to update two tables using single procedure in oracle?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by shyann , 2 months ago

@darrion.kuhn 

You can update two tables in Oracle using a single procedure by executing a separate update statement for each table within the procedure. Here is an example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
CREATE OR REPLACE PROCEDURE update_tables
IS
BEGIN
    UPDATE table1
    SET column1 = 'new_value'
    WHERE condition1;

    UPDATE table2
    SET column2 = 'new_value'
    WHERE condition2;
END;
/


In this example, the update_tables procedure updates table1 and table2 with new values based on specified conditions. You can modify the SQL statements within the procedure to suit your specific requirements for updating the tables.