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!

ORA-21700: object does not exist or is marked for delete - nested table

Manjusha MuraleedasMay 12 2011 — edited May 12 2011
Hi, please see my procedure . this is for deletion of records from a tables whose primary keys will be given in comma seperated format.

but it raises the following error

ORA-21700: object does not exist or is marked for delete
ORA-06512: at "scott.PKG_COUNTRY", line 4598
ORA-06512: at line 10
Pr_Del_Regional_DtlORA-21700: object does not exist or is marked for delete
Process exited.
Disconnecting from the database tfo_user-watson.


/* Formatted on 2011/05/12 14:47 (Formatter Plus v4.8.7) */



TYPE varchar_table IS TABLE OF VARCHAR2(5); -- in package scope


PROCEDURE Pr_Del_Regional_Dtl (
pi_v_country_id IN VARCHAR2,-- comma seperateed values for deletion
po_results OUT sys_refcursor
)
IS
l_varchar_table varchar_table := varchar_table ();
BEGIN
pr_split_varchar_values (pi_v_country_id, l_varchar_table); --splits the comma seperated values to nested table.

DELETE FROM regional_setup
WHERE country_id IN (SELECT *
FROM TABLE (l_varchar_table)); -- deletion
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('Pr_Del_Regional_Dtl' || SQLERRM);
RAISE;
END Pr_Del_Regional_Dtl;

splitting--
PROCEDURE pr_split_varchar_values (
pi_v_values IN VARCHAR2,
op_varchar_table OUT varchar_table
)
IS
l_v_value VARCHAR2 (3000);
l_value VARCHAR2 (10);
i PLS_INTEGER := 0;
BEGIN
op_varchar_table := varchar_table ();
l_v_value := pi_v_values;

WHILE LENGTH (l_v_value) > 0
LOOP
i := i + 1;

IF INSTR (l_v_value, ',') > 0
THEN
op_varchar_table.EXTEND;
op_varchar_table (i) :=
LTRIM (RTRIM (SUBSTR (l_v_value, 0, INSTR (l_v_value, ',') - 1)));
ELSE
op_varchar_table.EXTEND;
op_varchar_table (i) := LTRIM (RTRIM (l_v_value));
l_v_value := '';
END IF;

l_v_value :=
SUBSTR (l_v_value, INSTR (l_v_value, ',') + 1,
LENGTH (l_v_value));
END LOOP;
END pr_split_varchar_values;

Thanks in advance
This post has been answered by Saubhik Banerjee on May 12 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2011
Added on May 12 2011
2 comments
11,616 views