You are on page 1of 4

Y SSET SERVEROUTPUT ON Y SET VERIFY OFF DECLARE arrAHP varray arrChoice varray arrPrior varray intSumCols varray intSumRows

varray no_of_prior number(3); BEGIN

arrPrior(0) =3; arrPrior(1) =5; arrPrior(2) =7; CreatMatrix(); ColWiseSummantion(); RowWiseSummation(); END;

CREATE OR REPLACE PROCEDURE CreateMatrix () is i number(3); j number(3); intInverseVal number(3); intNonInverseVal Number(3); strOutput varchar2(100); Begin For i = 1..n Loop For j = 1..n Loop if (i=j) Then arrAHP(i,j) = 1; ElseIf (i < j ) Then intPrior = arrPrior(intNonInverseVal); arrAHP(i,j) = intPrior; intNonInverseVal = intNonInverseVal + 1; Else intPrior := arrPrior(intInverseVal); arrAHP(i,j) := 1 / intPrior; intInverseVal := intInverseVal + 1; End If;

End Loop; End Loop; For i = 1..n Loop For j = 1..n Loop strOutput = strOutput || arrAHP(i,j); End Loop strOutput := strOuptut || chr(13); End Loop DBMS_Output.PUT_LINE(strOutput); End;

CREATE OR REPLACE PROCEDURE ColWiseSummation () is i number(3); j number(3); intSum number(5,2); k number(3) := 0; Begin - Summing up all the colums and putting the values in the array For i = 0..n - 1 Loop For j = 0..n - 1 Loop intSum := intSum + arrAHP(j, i); End Loop intSumCols(k) := intSum; intSum := 0; k := k + 1; End Loop; k := 0; For i = 0..n - 1 Loop

For j = 0..n - 1 Loop arrAHP(j, i) := (arrAHP(j, i) / intSumCols(k)); k := k + 1 End Loop; k := 0; End Loop; End;

CREATE OR REPLACE PROCEDURE RowWiseSummation () is i number(3); j number(3); intSum number(5,2); k number(3) := 0; Begin - Summing up all the colums and putting the values in the array For i = 0..n - 1 Loop For j = 0..n - 1 Loop intSum := intSum + arrAHP(i,j); End Loop intSumRows(k) := intSum; intSum := 0; k := k + 1; End Loop; k := 0; For i = 0..n - 1 Loop For j = 0..n - 1 Loop arrAHP(i, j) := (arrAHP(i, j) / intSumCols(k)); k := k + 1 End Loop;

k := 0; End Loop; End; --- FInal Output Matrix Create or Replace Procedure FinalMatrix() is strOutput varchar2(100); Begin For i = 1..n Loop For j = 1..n Loop strOutput = strOutput || arrAHP(i,j); End Loop strOutput := strOuptut || chr(13); End Loop DBMS_Output.PUT_LINE(strOutput); End;

End Sub

You might also like