Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Object does not exist or is marked for delete" error in PL/SQL

814681Dec 13 2011 — edited Dec 14 2011
Hi,

I'm getting a "Object does not exist or is marked for delete" error when I'm trying to call a PL/SQL function.

I have a function in a package which accepts an array of VARCHARs and returns a ref cursor. It looks like this:
   FUNCTION my_function(p_param IN my_array_type) RETURN SYS_REFCURSOR IS
      l_result_cursor SYS_REFCURSOR;
   BEGIN
      OPEN l_result_cursor FOR
         SELECT <columns>
           FROM <tables>
          WHERE <column> IN (SELECT column_value FROM TABLE(p_param));
   
      RETURN l_result_cursor;
   END my_function;
There's also the following type declared in the package specification:
TYPE my_array_type IS TABLE OF table.column%TYPE;
When I try to get data back from the function using this code:
DECLARE
   l_refcursor  sys_refcursor;
   
   TYPE l_type IS RECORD(<columns>);
   l_record  l_type;

   l_array  my_package.my_array_type;
BEGIN
   --
   -- Initialise array.
   --
   l_array := my_package.my_array_type('One', 'Two');

   --
   -- Get data.
   --
   l_refcursor := my_package.my_function(p_param => l_array);

   LOOP
      FETCH l_refcursor INTO l_record;
      EXIT WHEN l_refcursor%NOTFOUND;
      DBMS_OUTPUT.PUT_LINE(l_record.<column>);
   END LOOP;

   CLOSE l_refcursor;
end;
I get the error. It's complaining on the "OPEN l_result_cursor FOR" line of the function.

Thanks in advance for any suggestions.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2012
Added on Dec 13 2011
8 comments
2,942 views