database:Oracle 7.x
coding

l/sql
table_size:125 million rows
table_name: ORDER_PROC
columns:
Name Null? Type
------------------------------- -------- ----
CUST_ID NOT NULL NUMBER(10)
DIV_CODE NOT NULL CHAR(2)
ORDER_ID NOT NULL CHAR(8)
LINE_NBR NOT NULL NUMBER(4)
TOTAL_DEMAND_AMT NUMBER(9,2)
ORDER_DISC_AMT NUMBER(9,2)
DISC_AMT NUMBER(9,2)
ORDER_DEMAND_AMT NUMBER(9,2)
INSERT_DATE DATE
Requirement: Update disc_amt
Formula: disc_amt=(total_demand_amt/order_demand_amt)*order_disc_amt
Condition: Order_disc_amt > 0
Read a summary of order_proc information into a cursor (summarize at cust_id, div_code, order_id level) Summarize total demand amt (line_nbr) and order_disc_amt (order_id). This summary data is required in updating.
I am Unix & SQL guy. I am not a pl/sql coding person. I know very little about cursors. struggled a week with my limited knowledge, now asking for help from a pl/sql expert. Any questions...? Thanking you in advance.