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!

How do I Delete an row/item from a custom Data Type?

568775Aug 10 2009 — edited Aug 10 2009
Hello all,

I am having trouble trying to delete a row from a custom data type.

As you will see in the code below I add a row to a Table Type (this is done multiple times). I then loop through each row in the table type and pass the id into a separate function. Once this is done I then need to delete that item from the Table Type - this is where i think my syntax is wrong because I get an error "ORA-00903: invalid table name".

Delete code
 DELETE FROM TABLE(CAST(l_DeleteList AS TEMP_DOCVERSIONID_TABLE)) WHERE docVersionID = l_DocVersID;
Full Code
l_DeleteList.extend;
l_DeleteList(l_DeleteList.last) := DOCVERSIONID(l_DocVersID);

.......................

select count(*) INTO v_count FROM TABLE(CAST(l_DeleteList AS TEMP_DOCVERSIONID_TABLE));
  -- loop temp table and delete document versions
  WHILE v_count > 0
  LOOP
  BEGIN
    SELECT docVersionID INTO l_DocVersID FROM TABLE(CAST(l_DeleteList AS TEMP_DOCVERSIONID_TABLE)) WHERE ROWNUM = 1;
    DeleteSingleDocumentVersion(l_DocVersID);
    DELETE FROM TABLE(CAST(l_DeleteList AS TEMP_DOCVERSIONID_TABLE)) WHERE docVersionID = l_DocVersID;
    select count(*) INTO v_count FROM l_DeleteList;
  END;
  END LOOP;
Thanks in advance,

Toby
This post has been answered by ravikumar.sv on Aug 10 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2009
Added on Aug 10 2009
9 comments
1,097 views