日期:2014-05-17 浏览次数:22128 次
DECLARE v_acc_month date; CURSOR c1 IS SELECT b.part_no || ' , ' || TO_CHAR (material.get_minor_wh_stock_qty (b.part_no, c.warehouse)) debit_item FROM material.minor_material b, public_mgr.warehouse c WHERE c.material_flag = 'Y' AND c.cost_flag = 'Y' AND material.get_minor_wh_stock_qty (b.part_no, c.warehouse) < 0; BEGIN FOR c1_rec IN c1 LOOP :text1 := :text1 || c1_rec.debit_item || CHR (10) || CHR (13); END LOOP; DECLARE vcount NUMBER := 1; vserial_no VARCHAR2 (4); CURSOR c1 IS ... BEGIN FOR c1_rec IN c1 LOOP INSERT INTO material.minor_materialiohis (part_no, cday, CATEGORY, iotype, qty, internal_sheetno, dept, part_name, serial_no, unit, deliveryed, origin_qty, stock_position, batch_no ) VALUES (c1_rec.part_no, c1_rec.cday, c1_rec.CATEGORY, c1_rec.iotype, c1_rec.qty, c1_rec.internal_sheetno, c1_rec.dept, c1_rec.part_name, TO_CHAR (vcount, '099'), c1_rec.unit, c1_rec.deliveryed, c1_rec.origin_qty, c1_rec.stock_position, c1_rec.batch_no ); vcount := vcount + 1; END LOOP; END; END;