Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> calling methods in cursors

calling methods in cursors

From: nilson <jmcdonald_at_ucdavis.edu>
Date: Sun, 29 Apr 2001 19:30:56 -0700
Message-ID: <9ciie9$2oj$1@woodrow.ucdavis.edu>

I'm having a bit of a problem calling a method I created in a datatype inside my cursor statement. Let's say I create a print method for a datatype:

create type abcd as object(
  attribute1 number,
  attribute2 number,
  member function print return number,
  pragma ...
);

create type body abcd as
  member function print return number is     BEGIN
      ...
  END;
END; create type abcdlist as table of abcd;

create table efgh (
  name varchar2,
  info abcdlist)
nested table info store as info_tab;

then I create a pl/sql procedure with a cursor in it that stores the number result of the print member function in type abcd for each of the nested info tuples in efgh:

create procedure pr(efgh_name) is
...

info_rec number;
counter number;
type num_type is table of number;
nested_table num_type := num_type();
...

cursor c1(efgh_name varchar2) is
select nt.print() from table(select info from efgh where name = pname) l;
...

begin
...

for info_rec in c1(efgh_name) loop
  nested_table.EXTEND;
  nested_table(counter) := info_rec;  -- here's where I get the error
  counter := counter + 1;
end loop;
...

END PR; I get an error at the -- comment above saying that expression is of wrong type, even though everything is in number type. Is this because methods can't be called within cursors? I tested the select statement etc. at the sql prompt and everything checked out.

Thanks,

Jeff Received on Sun Apr 29 2001 - 21:30:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US