Updating multiple rows in oracle

Posted by / 25-Jul-2020 19:17

INSERT ALL INTO mytable (column1, column2, column_n) VALUES (? ) INTO mytable (column1, column2, column_n) VALUES (? I am getting the data from more than one table to pupulate the table.I have created a Cursor: CURSOR c_fgsr IS SELECT DISTINCT SUM(b.qty/1000) inv_qty, a.division division, a.sopcust sopcust, a.program program, a.sopgrp sopgrp, a.sopclothtype sopclothtype, a.color_group color_group, a.sized sized, a.sopmfgtype sopmfgtype, a.product_type product_type, b.scheddate, DECODE(COUNT(a.skutype),1,a.skutype,'****') skutype, DECODE(a.sopmfgtype,'MAKE','NA','SOURCED') mfgloc FROM springs.si_sop_fgitem a, springs.si_sop_fgsr b WHERE = GROUP BY b.item, a.division, a.sopcust, a.program, a.sopgrp, a.sopclothtype, a.color_group, a.sized, a.sopmfgtype, a.product_type, b.scheddate, skutype FOR v_sr IN c_fgsr LOOP INSERT INTO springs.si_sop_aggr_fgsr (sbu, customer, program, sopgrp, cloth_type, fin_type, fin_size, mfg_type, prod_type, fg_type, mfg_loc, Mfg_fac) VALUES (v_sr.division, v_sr.sopcust, v_sr.program, v_sr.sopgrp, v_sr.sopclothtype, v_sr.color_group, v_sr.sized, v_sr.sopmfgtype, v_sr.product_type, v_sr.skutype, v_sr.mfgloc, NULL); n_ins_inv_cnt := n_ins_inv_cnt 1; END LOOP; This Insert statement inserts 100 records.I have about 60,000 rows that I'm needing to update the information from column_a to column_b.

update (select p.pid, p.paymentterm, t.paymentterm new_paymentterm from project p join temp_project t on = where coalesce(p.paymentterm,-1000) !I understand that I can do this with one row and it work with a nested select statement in an update statement.When trying to update multiple rows though I believe I'm getting stuck on having to have 60,000 unique key identifiers.One column named Mfg_fac is inserted with NULL value.Later I have to update this column mfg_fac with value fetched from tables springs.si_sop_fgitem and as below.

updating multiple rows in oracle-86updating multiple rows in oracle-59updating multiple rows in oracle-9

SQL SET SERVEROUTPUT ON DECLARE TYPE t_desc_tab IS TABLE OF t1.description%TYPE; TYPE t_tab IS TABLE OF t1%ROWTYPE; l_desc_tab t_desc_tab := t_desc_tab('FIVE', 'SIX', 'SEVEN'); l_tab t_tab; BEGIN FORALL i IN l_desc_tab.first ..

One thought on “updating multiple rows in oracle”