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

Thread: Object Help

  1. #1
    Join Date
    Jan 2001
    Posts
    515
    I need some help with objects. My object is as follows:
    type myrctype is ref cursor return ACCOUNT%ROWTYPE;

    In my PL/SQL function I have a statement like this.

    rc myrctype;

    begin

    open rc for select * from account;
    return rc;

    It then selects everything from account and returns it. My problem is how to display the results in SQL Plus. I do something like the following but it doesn't work:

    declare

    x myrctype;

    begin

    x := myfunction();
    dbms_output.put_line(x);
    end;
    /

    It works fine without the dbms_output statement. I want to display the results. Can anyone help me with this?

  2. #2
    Join Date
    Feb 2001
    Posts
    123
    Before dbms_output.put_line will output to the screen, you need to execute the SQL*Plus command 'set serveroutput on'

    HTH

    David.

  3. #3
    Join Date
    Jan 2001
    Posts
    515

    Thanks

    I already have that set. It still doesn't work.

  4. #4
    Join Date
    Feb 2001
    Posts
    123
    In that case, I wonder if it is to do with the data type of the variable x - put_line will only write character strings, so try making a character string (if neccessary by concatenating the individual elements of x, using to_char where neccessary on numerics and dates).

    HTH

    David.

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