I have this function:
Procedure UpdateDefaultWeight ( vYear Number, costWeight Number, qualityWeight Number, serviceWeight Number )
AS
type weight_table is table of Number(5,2) index by varchar2(50);
weightArray weight_table;
currentPosition varchar2(50);
Begin
weightArray('Cost Weighting') := costWeight;
weightArray('Quality Weighting') := qualityWeight;
weightArray('Service Weighting') := serviceWeight;
currentPosition := weightArray.first;
Loop
Exit When currentPosition is null;
Insert Into GVS.GVSSD16_DFLT_WEIGHT
( cal_year, metric_name, metric_val )
Values
( vYear, currentPosition, weightArray(currentPosition) );
currentPosition := weightArray.next(currentPosition);
End Loop;
END;
Now that I wrote it, it just does an INSERT. However, I need this for UPSERT. I looked at the MERGE documentation, but basically it just confused me how to apply the syntax to my specific case.
I looked here and here , and I get this, but the syntax does not allow me.
Anyone want to help Oracle newbies?
source
share