differnce between Ref Cursor strong and weak Ref Cursor

differnce between Ref Cursor strong and weak Ref Cursor

SQL and PL/SQL FAQ

-------------
Sybrand Bakker
Senior Oracle DBA

Tags: Database

Similar Questions

  • DIFFERENCE BETWEEN THE STRONG AND THE SLIDERS OF THE WEEK IN ORACLE

    Hi all

    Can someone tell me please... What the Ref cursor.in, in which case we use the ref cursor .and what is difference between strong and week ref cursor.

    Thanks in advance,
    Sanjeev.

    Hello

     What is Ref Cursor :
    ---------------------------------------------------------------------------------------
    
    -->It is aslo a user defined type
    -->ref cursor allows you to declare the  cursor variable those are independent of select statement
     i .e
       the cursor variable declared using ref cursor type is ready to accept any select statement dynamically at the time of opening
    
    -->Ref cursor are of two types
    
      1) A Strong ref cursor(also called static structure type)
    2)Weak ref cursor(also  called dynamic structure type )
    
    1)Strong ref cursor:
    -->When return type included then it is called strong or static structure type
    -->static ref cursor support different  type of select statement but all of same strucure ,but not neccessary that the table should be same
    2)Weak Ref  Cursor:
    
      this ref cursor allows us to any  type of select statement irrespective of data structure . i .e any table
    
    Ref Cursor:
    
    Syntax:
      type  is ref cursor [return ];
    syntax for open statement:
      open  for select statement .......;
    

    Example of strong cursor

     --------Strong cursor ----------------------
    
     declare
    
     type emprefcur is ref cursor return emp%rowtype;
     ec emprefcur;
     v_ec ec%rowtype;
    begin
      open ec for select * from emp;
     loop
          fetch ec into v_ec;
          exit when ec%notfound;
         print(v_Ec.empno);
         print(v_ec.ename);
     end loop;
    close ec;
    
     print('-------------------------------------------------------------------------'):
      open ec for select * from emp;
     loop
          fetch ec into v_ec;
          exit when ec%notfound;
         print(v_Ec.empno);
         print(v_ec.ename);
     end loop;
    close ec;
    
     end;
    

    Example of low slider
    -------------

    declare
    ------------------weak cursor --------------------------
    type refcur is ref cursor;
     xc refcur;
    v_Ec emp%rowtype;
    v_dc dept%rowtype;
    begin
      open xc for select * from emp;
    loop
         fetch xc into v_ec;
     exit when xc%notfound;
      print(v_ec.ename);
      print(v_Ec.empno);
    end loop;
    
    close xc;
    
    print('--------------------------------------');
    open xc for select * from dept;
    loop
         fetch xc into v_dc;
         exit  when xc%notfound;
      print(v_dc.deptno);
      print(v_dc.dname);
      print(v_dc.loc);
    
    end loop;
    close xc;
    
    end;
    

    Thank you
    Prakash P

    Published by: prakash on December 19, 2011 21:14

  • What is the Differnce between HashMap and HashTable?

    Hi all

    What is the Differnce between HashMap and HashTable?

    I'm confuse. !!


    Thanks to advnce.

    This question is answered in the Javadoc here http://download.oracle.com/javase/6/docs/api/java/util/HashMap.html and here http://download.oracle.com/javase/6/docs/api/java/util/Hashtable.html. The thread to block.

    Published by: EJP on 12/07/2010 13:27

  • Differnce between 'GATHER EMPTY' and 'BLAND GATHER'

    Hey experts,.
    What is the exact differnce between below 2 statements

    1
    dbms_stats.GATHER_SCHEMA_STATS( user , method_opt => 'FOR ALL COLUMNS SIZE AUTO', options => 'GATHER EMPTY' , degree => 4 ) ;
    2nd
     dbms_stats.GATHER_SCHEMA_STATS( user , method_opt => 'FOR ALL COLUMNS SIZE AUTO', options => 'GATHER STALE' , degree => 4 ) ; 

    Documentation for GATHER_SCHEMA_STATS :

    + STALE GROUPING: collects statistics on obsolete objects as determined by looking at the views of tabmodifications. Also, return the list of items found to be stale. +

    GATHER EMPTY: Collects statistics on objects that currently have no statistics. In addition, return a list of objects found to have no statistics.

  • Difference between nio-file manager and nio-memory-manager

    Hello
    What is the difference between nio-file manager and memory manager Ian? The documentation is not really discuss the differences as far as I know. They all use two nio to store files mapped into memory Don't they? What are the advantages/disadvantages of both?

    When to choose the first and when the second during the storage of a large amount of data? Can be used to query data with the filter API? Are there any size limits on both?

    Best regards
    Jan

    Hi Jan,

    The difference is that one uses a memory-mapped file and used memory direct nio (as part of the memory allocated by the JVM process) to store data. Both allow data cached out-of-heap storage, which can store more data with a knot of unique cache (FMV) without long GC pauses.
    If you use a 32-bit JAVA virtual machine, JVM process will be limited to a total of ~ 3 on Windows and 4 GB on Linux/Solaris. This includes lots and out of the stack of memory allocation.

    Regarding the size of the limitations for the Manager of files-Ian, please see the doc the following for more information.
    With version 3.5, now is the idea of a Partitioned card support that allows to create more large (up to 8 GB of capacity) for storage of nio. Please refer to the following, doc.

    Both can be used to query the data, but it is worth noting that the index will be stored in the heap.

    HTH,
    -Dave

  • Difference between the rejected product and icing.

    Hello

    I downloaded my app on BB app world with version 1.0

    The app has been denied because of a problem. When I checked the history of changes to my product, is showing 2 entries relese refused and refused. Is there a differnce between these two?

    In addition, now I added the version 2.0 but it's showing me in the project and giving no option like "send for review".

    Is it because my product and release the two has been denied?

    Help, please.

    @BB_Developement not quite.

    You don't need to add a new product. The product already exists now.

    Your next step is to push the product for the project. Then add a new version (or submit a more current pushing the project).

    Last step is to submit it for review. This will push both the produced and communicated to awaiting review.

  • Time difference between extraction in bulk and standard fetch?

    Hello world

    I have performed below block in the SCOTT schema for the gap between the standard extraction and extraction block. I read that extraction is more standard fast recovery. How ever the results were opposed as shown below.

    Resut

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

    PL/SQL procedure successfully completed.

    the extraction time is 114

    the time required for extraction bulk is 136

    Block I ran

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

    declare

    type owner_name_t is table of the all_objects.object_name%type;

    owner_c owner_name_t;

    object_name_c owner_name_t;

    number of l_start;

    number of l_end;

    cursor c1 is

    Select the owner, object_name object;

    Start

    l_start: = dbms_utility.get_time;

    I'm in c1

    loop

    null;

    end loop;

    l_end: = dbms_utility.get_time;

    dbms_output.put_line (' the extraction time is ' |) (l_end-l_start)) ;

    l_start: = dbms_utility.get_time;

    -car me in c1

    Open c1;

    loop

    When exit c1% notfound;

    collect the fetch c1 into loose in owner_c, object_name_c;

    end loop;

    Close c1;

    l_end: = dbms_utility.get_time;

    dbms_output.put_line (' bulk is the time needed to extract ' |) (l_end-l_start)) ;

    end;

    Can someone suggest as to why it happened?

    Thanks and greetings

    580988 wrote:

    Hello world

    I have performed below block in the SCOTT schema for the gap between the standard extraction and extraction block. I read that extraction is more standard fast recovery. How ever the results were opposed as shown below.

    Can someone suggest as to why it happened?

    Thanks and greetings

    Well I run your code using Oracle 12 c and based on your query in your cursor may be the first time that it will be a little different but then I noticed your code and I wonder... WHY you BULK COLLECT within the loop?

    That's the whole point of the bulk to pick you up.  Get you ONCE... in 'bulk '.

    Here is your code changed on my db and my result set

    SET SERVEROUTPUT ON
    
    DECLARE
    
       TYPE owner_name_t IS TABLE OF all_objects.object_name%TYPE;
    
       owner_c         owner_name_t;
       object_name_c   owner_name_t;
       l_start         NUMBER;
       l_end           NUMBER;
    
       CURSOR c1 IS
          SELECT owner
                ,object_name
            FROM all_objects;
    
    BEGIN
    
       l_start := DBMS_UTILITY.GET_TIME;
    
       FOR I IN c1 LOOP
          NULL;
       END LOOP;
    
       l_end := DBMS_UTILITY.GET_TIME;
    
       DBMS_OUTPUT.PUT_LINE ('The time required for fetch is ' || TO_CHAR(l_end - l_start)));
    
       l_start := DBMS_UTILITY.GET_TIME;
    
       OPEN c1;
    
       --LOOP
          --EXIT WHEN c1%NOTFOUND;
    
       DBMS_OUTPUT.PUT_LINE('Fetching bulk collect');
    
       FETCH c1
        BULK COLLECT
        INTO owner_c, object_name_c;
    
       --END LOOP;
    
       CLOSE c1;
    
       l_end := DBMS_UTILITY.GET_TIME;
    
       DBMS_OUTPUT.PUT_LINE ('The time required for bulk fetch is ' || TO_CHAR((l_end - l_start)));
    
    END;
    /
    

    Result set

  • I was wondering what the difference was between the powerbeats 2 and the powerbeats 3. What is this new "chip" in the powerbeats 3?

    I was wondering what the difference was between the powerbeats 2 and the powerbeats 3. What is this new "chip" in the powerbeats 3?

    Hello

    Main differences are:

    • Up to 12 hours of battery life with Powerbeats3, which use chips to W1 Apple energy-efficient (vs. up to 6 hours of battery life with Powerbeats2).
    • A quick charge of 5 minutes for a typical use of an hour (vs 15 minutes to load).
    • Improved ergonomic design.

    More information:

    http://www.Apple.com/shop/product/MNN02LL/A/powerbeats3-wireless-earphones-shock-Jaune

    http://www.beatsbydre.com/earphones/browse-earphones/wireless-earphones/ML8V2.ht ml

  • How can I compare prices between iPhone Upgrade Program and refinancing?

    I wonder this for years, and it's how can I see how much is a new iPhone (say if I am refinancing a 6 s 16 GB iPhone), how much will cost each month and how much an iPhone cost in case of upgrade program. So if we are on the upgrade program, can OK, I buy it in the stores of carrier? What are the benefits of refinancing? Can I exchange a phone located to midway between the refinancing period and use the program to update iPhone and will I pay less each month? And after 12 months, what I have to pay the tax and the money to upgrade to a new iPhone, or is it just continue to pay $32 per month?

    Visit their Web sites. All the details are there for you to browse and decide what suits you best. Only you can decide.

  • New window creates a gap between the Favorites (top) and tabs (bottom)

    19/12/14 bug Firefox began to occur:

    • When having only 1 window open and opening tabs behaves normally.
    • However, when you open a new window of the space between the bookmarks (top) and tabs (bottom) spans all windows. Its boring.

    So far only challenge is to just close and open 1 single window, or to use the module 'Classic theme restaurateur' and switch the tabs position from the bottom to the top, but all new windows will open the gap again.

    Image below.

    Unfortunately, none of these options works, so far, use 'CTR' and turn the legs up (default) allows the opening of new windows without gaps.
    Seems to be some sort of bug recently showing on CTR.

    You will need to find a way to contact the developer to let them know.

    EDIT: It seems to be resolved, seems a new version was released and the problem disappeared. Thank you very much for the help.

  • Dropbox for bookmarks or downloads of the navigation bar adds space between the navigation bar and bar bookmarks.

    When I press the button edit bookmark or download the toolbar for navigation that a line of space appears between the navigation bar and the bookmarks toolbar. This problem is corrected when I start Firefox in safe mode, but not when I boot normally and disable all addons. Please tell us how to solve this problem. Reseting Firefox and install all add ons still causes too many problems, so I hope to be able to solve this problem without reset.

    [url =http://postimg.org/image/uwr2x6x21/] [img] http://S28.postimg.org/uwr2x6x21/space.jpg line / URL

    You can also try to delete the file localstore.rdf (resets the toolbar configuration) in the case of its corrupt.

  • I can't transfer file via airdrop between the macbook pro and my iphone 6.

    Hello world

    just bought a new macbook pro 2015 and I can't transfer file via airdrop between the macbook pro and my iphone 6.

    Can someone please help me solve this problem?

    Thank you

    < re-titled by host >

    First check the steps to run the drop:

    Use AirDrop to send the contents of your Mac - Apple Support

    There are some work around to try airdrop work:

    1. Turn off Bluetooth on your Mac.
    2. Delete /Library/Preferences/com.apple.Bluetooth.plist
    3. Re-turn on Bluetooth

    You can find more info here:

    Transfer and AirDrop does not work in El Capitan

    If you do not see all of your device, it means that you are affected by the same problem, I have known, since the upgrade to OS X the air drop of Captain does not work.

  • Icon strange sudden appearance between the address bar and search engine

    A weird icon suddenly appeared between the address bar and search engine... It looks like a 'ball' for a character of cardboard. Cannot understand the source or meaning. Thank you in advance.


  • Re: What is the different between the NB550D-109 and the NB550D - 10G?

    Hello guys. I need help on the NB550D. What is the different between the NB550D-109 and the NB550D - 10G? Is just the color?

    I checked the specifications and I find no difference. Both models have the same part number, so both belong to portable computers with the same hardware configuration. Thus, the difference can be color only.

    What I see is the 109 NB550D offered in more countries than NB550D - 10G.

  • What is the difference between the Service Station and Tempro?

    Searched for information on this, but have not been able to find:

    What is the difference between the Service Station and Tempro?

    I just run the wizard upgrade Toshiba and it installed the gas station but Tempro is already installed and seems to do the same.

    Concerning

    Bushy

    Hello

    These two tools are Toshiba one informs you of the new driver updates available on the Toshiba driver page.

    AFAIK Tempro is slightly older than the gas station.
    In addition the gas station seems to provide a bit more options and features like tool Tempro.
    However, I recommend using one my favorite utility's Service Station

Maybe you are looking for