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!

Does cursor declaration and then it's Fetch cause performance issue

UtsavApr 23 2020 — edited Apr 24 2020

I came across a scenario where a cursor was declared in the package specification which then used in Package Body.

Create or replace package pkg_legacy

as

cursor c1 is select * from heavy_table;

end pkg_legacy;

create or replace PACKAGE BODY pkg_legacy

as

      procedure prc

      is

      begin

         for rec in c1 loop

         do_something;

         end loop;

      end prc;

end pkg_legacy;

DBMS_HPROF show that Function

TypeFunction elapsed timeSqlIDSQL Text
package body100000fhskmsnj5v4t8select * from heavy_table
package Spec5000fhskmsnj5v4t8aselect * from heavy_tableble

Does the cursor declaration really consume resources? Is there a way to reduce resource consumption?

Thanks,

Prashant

This post has been answered by BEDE on Apr 23 2020
Jump to Answer
Comments
Post Details
Added on Apr 23 2020
3 comments
435 views