We have a lot of tables which contain 3 cols (RID,PARTNER,SUPPLIER). I want to update theese cols, but only in 4 tables - depends on PK.
so i started something, but i stuck:
BEGIN
FOR i IN
(select table_name from all_tab_columns where column_name = 'RID' /*PK*/
and column_name = 'PARTNER' or column_name = 'SUPPLIER')
LOOP
EXECUTE IMMEDIATE 'UPDATE ' || i.table_name|| 'set PARTNER = :newvalue where PARTNER = :oldavalue and RID = :ridvalue'
USING (newvalue, oldvalue, ridvalue)
END LOOP
END
Problems:
- I dont know, how can i update multiple cols with this method
(because in tables exists
PartnerorSupplier,eg: in one table is itPartner, in antoher table is itSupplier) - I want to update only (
PartnerorSupplier) but only in 1 table, depends on PK - Is this a workable solution ?