DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: fetch all rows

  1. #1
    Join Date
    Apr 2006
    Posts
    8

    fetch all rows

    Hi,
    please who can tell me why my cursor fetch me only the data of first row.
    DECLARE
    /* Explicit declaration of a cursor */
    CURSOR CUR IS
    SELECT ALL ID_BOSS,CNSS_BOSS
    FROM MATRICULE_CNSS_BOSS;
    BEGIN
    /* Check to see if cursor is already open. If not, open it. */
    IF NOT cur%ISOPEN
    THEN
    OPEN cur;
    END IF;
    FETCH cur INTO :BOSS,:CNSS;
    CLOSE cur;
    END;
    i like to fetch all the rows thx

  2. #2
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492

    Cool


    The following statement will only fetch ONE row:
    Code:
    FETCH cur INTO :BOSS,:CNSS;
    In order to fetch next rows you need LOOP..END LOOP.
    I recommend you read the manual
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  3. #3
    Join Date
    Nov 2003
    Location
    Ohio
    Posts
    51
    BEGIN

    for cur in (SELECT ID_BOSS, CNSS_BOSS
    FROM MATRICULE_CNSS_BOSS)
    loop

    -- do some processing
    dbms_output.put_line(cur.id_poss || ' / ' || cur.cnss_boss);

    end loop;

    END;

    .. and as LKBrwn_DBA says the details are in the manual.
    ____________________
    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width