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

Thread: PLS-00306 explicit vs implicit cursors

  1. #1
    Join Date
    Apr 2007
    Posts
    2

    PLS-00306 explicit vs implicit cursors

    I have a package similar to this simplified example:


    create or replace package test is
    PROCEDURE recon_2;
    PROCEDURE recon_3;
    PROCEDURE recon_4;
    end test;


    create or replace package body test is

    PROCEDURE recon_1
    (fiid iforce_riadmin.transactions.fi_src_sys_cd%TYPE)
    IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE ('COMPLETED: '||fiid);
    END;


    PROCEDURE recon_2 IS
    BEGIN
    recon_1 ('wach');
    END;


    PROCEDURE recon_3 IS
    CURSOR c_fiid IS
    SELECT distinct 'wach'
    FROM iforce_riadmin.transactions;
    BEGIN
    FOR fiid in c_fiid LOOP
    recon_1 (fiid); --<<-- PLS-00306 error
    END LOOP;
    END;


    PROCEDURE recon_4 IS
    CURSOR c_fiid IS
    SELECT distinct 'wach'
    FROM iforce_riadmin.transactions;
    fiid iforce_riadmin.transactions.fi_src_sys_cd%TYPE;
    BEGIN
    open c_fiid;
    loop
    fetch c_fiid into fiid;
    exit when c_fiid%notfound;
    recon_1 (fiid);
    end loop;

    END;

    end test;



    PROCEDURES recon_1, 2, and 4 are compiling without a problem.

    How come recon_3 does not compile and give PLS-00306 wrong number or types of arguments in call to 'RECON_1' ??

  2. #2
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135
    PROCEDURE recon_3 IS
    CURSOR c_fiid IS
    SELECT distinct 'wach'
    FROM iforce_riadmin.transactions;
    BEGIN
    FOR fiid in c_fiid LOOP
    recon_1 (fiid); --<<-- PLS-00306 error
    END LOOP;
    END;

    Try this:

    Code:
    PROCEDURE recon_3 IS
      CURSOR c_fiid IS
      SELECT distinct 'wach' as colname
        FROM iforce_riadmin.transactions;
    BEGIN
        FOR fiid in c_fiid LOOP
               recon_1 (fiid.colname); 
        END LOOP;
    END;

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