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

Thread: dbms_output question

  1. #1
    Join Date
    Jan 2001
    Posts
    515
    I have the following code:

    declare
    x staff_olam.security_cursor;
    begin
    staff_olam.staff_security_fetch('ethan',x);
    dbms_output.put_line(x);
    end;
    /


    the x is a cursor with 4 records in it and I am getting this error.

    declare
    *
    ERROR at line 1:
    ORA-06550: line 5, column 1:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 5, column 1:
    PL/SQL: Statement ignored

    how to I print the contents of the cursor to the screen?


  2. #2
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    You will have to cycle through your cursor and use dbms_output.put_line for each record in your cursor.
    Jeff Hunter

  3. #3
    Join Date
    Apr 2001
    Posts
    47

    Smile

    Hi lesstjm,

    DBMS_OUTPUT.PUT_LINE doesn't accept a variable of type CURSOR - that's why you got the eror message. You have to pass to this procedure the result of the fetching (a number, varchar or date...), not the cursor itself.

    Regards,

  4. #4
    Join Date
    Aug 2000
    Posts
    462
    numbers are fine. Don't use boolean, and clearly you can't use any user defined types (including cursors). There's no way Oracle would know how to output that data. You'll have to do that one field at a time through your procedure.

  5. #5
    Join Date
    May 2000
    Posts
    58
    ---------------------
    kris109 DBMS_OUTPUT.PUT_LINE is limited that way:

    You can not display any datatype other than CHAR, VARCHAR2. All other datatypes need conversion or you will get an error.
    -------------------------
    DBMS_OUTPUT.PUT_LINE will display data, number , char and varchar2 without any converions. It is a overloaded function.

  6. #6
    Join Date
    May 2001
    Location
    San Francisco, California
    Posts
    511
    DBMS_OUTPUT.PUT_LINE is limited that way:

    You can not display any datatype other than CHAR, VARCHAR2, NUMBER AND DATE. All other datatypes you will get an error.

    Moreover, you can not display BOOLEAN datatypes or CURSORS as in this case.

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