Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Tweak cursor query so that it can execute only one time

ADUserMay 21 2014

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 18 2014
Added on May 21 2014
0 comments
104 views