Forum Stats

  • 3,784,130 Users
  • 2,254,896 Discussions
  • 7,880,702 Comments

Discussions

Tweak cursor query so that it can execute only one time

ADUser
ADUser Member Posts: 3
edited May 21, 2014 2:51AM in SQL & PL/SQL

Dear All,

I have a cursor will get executed 7-8 times depending upon different input parameter. I am looking for an option where i can execute and get the data in one shot.

lv_hours              NUMBER;

CURSOR C1

(P1 number, P2 varchar2) IS

Select cc.value1 from

xx_table1 aa,

xx_table2 bb,

xx_table3 cc,

where aa.column=bb.column

and cc.column=bb.column

and bb.column =P1

and cc.column =P2;

1 Call

----------------

OPEN C1  (P1, 'TSN');

      FETCH C1

       INTO lv_hours

      CLOSE C1;

2 Call

----------------

OPEN C1  (P1, 'CSN');

      FETCH C1

       INTO lv_hours

      CLOSE C1;

 

Please advise

  

Thanks,

ADUser

This discussion has been closed.