1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

unable to display records in sql*plus fetched through cursor

Discussion in 'SQL PL/SQL' started by laxman, Jul 7, 2009.

  1. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    I am facing one problem while executing this pl/sql block.i wanted to dispaly the records in sql*plus fetched through cursor with the help of dbms_out package but unable to do so.also i have attempt various way to display it by declaring the dbms_output in few section of the block but it showing compile error with follwing message

    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    So my query is where i can put dbms_output in this pl/sql block to diplay the fetched records

    Code (SQL):
    DECLARE
       CURSOR cur
       IS
          SELECT emp_no, ename
            FROM emp_details;

       eno   cur%ROWTYPE;
    BEGIN
       OPEN cur;

       LOOP
          FETCH cur
           INTO eno;

          dbms.output.put_line ('emp details is ' || eno);
          EXIT WHEN cur%NOTFOUND;
          dbms.output.put_line ('emp details is ' || eno);
       END LOOP;

       dbms.output.put_line ('emp details is ' || eno);

       CLOSE cur;

       dbms.output.put_line ('emp details is ' || eno);
    END;
    Regards
    Laxman
     
  2. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    hi.. just an observation, not an answer to your query,

    You have got a "." in your dbms_output call. It is dbms_output and not dbms.output
     
    laxman likes this.
  3. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    In addition to that you have to display each value seperately like..

    Code (SQL):

    dbms_output.put_line ('emp details is --' ||TO_CHAR(eno.emp_no)||' : '|| eno.ename);
     
     
    laxman likes this.
  4. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    OOPS! for this minor mistake i have taken ur time i extremely soory for that.
    Thanks once again

    Regards
    Laxman
     
  5. laxman

    laxman Forum Expert

    Messages:
    144
    Likes Received:
    0
    Trophy Points:
    230
    Location:
    MUMBAI
    Thank you very much sir.

    Regards
    Laxman