This discussion is archived
3 Replies Latest reply: Feb 4, 2013 11:08 PM by jeneesh RSS

which is best way to improve the performance out of two ways..

989138 Newbie
Currently Being Moderated
Hi,

Can any body give me a suggition on the below scnerio as a performance prospective.

My scnerio is i have one cursor, it may give more than 10000 records and for each record some logic has to execute
I have two ways to develop this logic .Can any body please tell me which way is better as performance wise
below is the code

1st way:(with stand alone procedure)
----------

for i in cursor
loop
If (4 conditions need to be checked) then --case(1)
----logic
elsif (different 4 conditions need to be checked) then --Case(2)
---logic
elsif (different 4 conditions need to be checked) then --Case(3)
--logic
.................
..............
elsif (different 4 conditions need to be checked) then --Case(8)
--logic
end if;
end loop;

2nd way:(with package contains of 8 functions and 1 procedure)
------------

create a package contains 8 functions like for each case one function is created and inside the each function will check the conditions ,
if satisfy the conditions then return TRUE else FALSE

for i in cursor
loop
If fun_1 then --case(1)
----logic
elsif fun_2 then --Case(2)
---logic
elsif fun_3 then --Case(3)
--logic
.................
..............
elsif fun_1 then --Case(8)
--logic
end if;
end loop;


Which is the best way to proceed as performance prospective.Please suggest on this.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points