How to delete a line item / of a custom Data Type?

Hi all

I can't tried to delete a line of a custom data type.

As you will see in the code below I add a line to an array of Type (this is done several times). I then loop through each row in the type of array and pass it the id in a separate function. Once it is I so need to remove this item from the array Type - that's where I think my syntax is wrong because I get an error "ORA-00903: invalid table name.

Clear code
 DELETE FROM TABLE(CAST(l_DeleteList AS TEMP_DOCVERSIONID_TABLE)) WHERE docVersionID = l_DocVersID;
Complete 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

Trim element removes it from the end of the collection... but you are a loop of the collection from the first to the last clue.

If you use delete then the item is deleted but index still exists... then array.last and County are not equal...

You can use something as shown in this example (rather than use a time loop on many items)... after deleting an item to browse a table...

SQL> Declare
  2     TYPE    TYP_TAB IS TABLE OF PLS_INTEGER ;
  3     my_tab  TYP_TAB := TYP_TAB( 1, 2, 3, 4, 5 );
  4     v       Pls_Integer ;
  5  Begin
  6     my_tab.DELETE(2) ;
  7     v := my_tab.first ;
  8     Loop
  9        Dbms_Output.Put_Line( 'my_tab(' || Ltrim(To_char(v)) || ') = ' || my_tab(v) ) ;
 10        v := my_tab.NEXT(v) ; -- get the next valid subscript
 11        Exit When v IS NULL ;
 12     End loop ;
 13  End ;
 14  /
my_tab(1) = 1
my_tab(3) = 3
my_tab(4) = 4
my_tab(5) = 5

Published by: ravikumar.sv on August 10, 2009 15:19

Tags: Database

Similar Questions

  • How can I add a program to the start selective msconfig and how to delete a startup item?

    How can I add a program to the start selective msconfig and how to delete a startup item? Once, I knew but forgot.

    Remove items not controlled in MSConfig
    http://www.PCWorld.com/article/255514/remove_unchecked_items_from_msconfig.html

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/default.aspx/KB/929135

  • Help the insertion of an unknown number of lines in a custom Data Type

    Hi all

    I need help in the insertion of an unknown number of lines in a custom Data Type

    In Oracle I was thinking something like...
    CREATE OR REPLACE TYPE &HKDB_Schema_Name..SOMEDATA AS OBJECT (ID int, Name varchar2);
    /
    CREATE OR REPLACE TYPE &HKDB_Schema_Name..TYP_TABLE AS TABLE OF &HKDB_Schema_Name..SOMEDATA;
    /
    
    CREATE OR REPLACE PROCEDURE &HKDB_Schema_Name..SProc1
    (
    )
    AS
    l_TempTable TYP_TABLE := TYP_TABLE();
    v_count NUMBER := 0;
    l_ID int;
    l_Name varchar2(200);
    BEGIN
     
      LOOP
      -- exit the loop if the select returns no results. (look if exists in l_TempTable)
      v_count := SELECT COUNT(*) FROM Person p WHERE p.ID NOT IN (SELECT ID FROM TABLE(CAST(l_kgListTable AS TEMP_KGID_TABLE)));
    
      -- select the top result
      SELECT p.ID, p.UserName INTO l_ID, l_Name FROM Person p WHERE p.ID NOT IN (SELECT ID FROM TABLE(CAST(l_kgListTable AS TEMP_KGID_TABLE)))  
      AND ROW_NUM = 1;
    
      insert data into custom data type
      l_TempTable.extend;
      l_TempTable(l_TempTable.last) := SOMEDATA(l_ID, l_Name);
    
      EXIT WHEN v_count < 1;
      END LOOP;
    END SProc1;
    While I don't know this will probably do the job, it feels not very effective, have to select where the argument no_lig = 1 and then insert a facility on time. Is there a better way to do it?

    Basically, it's a migration of a MSSQL stored procedure where the equivalent would be...
    DECLARE @TempTable TABLE (ID int, Name varchar)
    
    INSERT INTO @TempTable (ID, Name) (SELECT ID, UserName FROM Persons)
    Thanks in advance,
    Toby

    Oh sorry you posted that before but I missed it. In this case maybe you should simply remove the

    as "HasChildren"{pre} part. This is only valid for a column name, but you input that expression directly into a type. It is not a column at this point.
    
  • Web Services - getBPList() - how NOT to return line items?

    Hello

    For the web service call getBPList results including all elements of line with all the fields.  We have included a list of fields and who works for the top section, but all the line items with all line item fields are also returned.

    Here are the web service call:

    " < soapenv:encodingStyle gen: getBPList = ' http://schemas.xmlsoap.org/SOAP/encoding/ ">

    < short name > * < / shortname >

    < authcode > * < / authcode >

    < projectNumber > < / projectNumber >

    Sellers of < BPName > < / BPName >

    < NomsChamps >

    record_no < fieldname > < / fieldname >

    title < fieldname > < / fieldname >

    uveVendorIDTB16 < fieldname > < / fieldname >

    uveVendorNameTB50 < fieldname > < / fieldname >

    uuu_contact_company < fieldname > < / fieldname >

    < fieldname > status < / fieldname >

    < / fieldnames >

    < filterCondition > status = Active < / filterCondition >

    < filtervalues / >

    < / gen: getBPList >

    Thank you

    Rudy

    Usually the easiest way to get data out of unifier is to create a UDR who has the specific data that you want and then you can use the web service getUDRData. Having a UDR allows to choose the fields specific (or just the top shape in your case), and to put in place filters you can (registration State,...).

  • How to make your custom data type used in your QListDataModel to QML?

    I have QListDataModel filled with objects of a custom class carying data and defined with Q_DECLARE_METATYPE. So far, it works however I can't access the data in qml:

    e.g. text: ListItemData.Name
    

    I read that this can be solved by letting QML know your custom class/type, but how to do this?

    See

    https://developer.BlackBerry.com/native/documentation/Cascades/dev/integrating_cpp_qml/

    example:

    qmlRegisterType("com.isec7.materials", 1, 0, "Account");
    
  • How to delete several lines in the details Table with PRIMARY KEY = ("VID", "LINEITEM")?

    Mr President

    My worm Jdev is 12.2.1.

    I have master tables / details.

    I have 2 lines for each PRIMARY KEY = ("VID", "LINEITEM") as below in the Details table.

    delete.png

    Please help how to get a button on a jsf page to remove these two lines at a time.

    Concerning

    So, in your app (data model) module, you have a master relationship / typical retail:

    And the relationship between them is based on some ViewLink

    Now go to the ViewLink, relationship, accessor.

    Take a look at the Destination accessor.

    Generate accessor object to check and give a name Acessor

    Then go to the master VO, Java and Include accessor, the class generate a display line:

    Go to the class view Java generated line, you'll find a method with the name of the accessor of the previous step, in the form of:

    public RowIterator getYourDetails...or_whaterever_IsAccessorName..() {
    }
    

    Now, in the same Java class, write the following Java method:

    public void removeDetails(){
      RowIterator details = getYourDetails...or_whaterever_IsAccessorName..(); // it is RowIterator over all details
      Row r = details.first();
      while (r != null) {
          r.remove();
          r = details.next();
      }
    }
    

    This method on the Cilent export line Interface:

    Finally, pass the data controls and drop this operation on the form as a button...

  • You press on delete all selected items by browsing the data store and accidentally deleted a vmdk file which has the OS on it

    I accidentally deleted the vmdk file that has my OS on it by pressing the "Delete selected items" button in the window of browser data store. Is there anyway to recover? I have a snapshot that doesn't seem to work. There is still the VMDK file in there, but it has now 'delta' be added at the end. Now I get an error message when I try to turn on my VM saying that he doesn't get the vmdk file, of course.

    delta.PNG

    errorVMDK.PNG

    From the screen shots looks you have deleted only the descriptor hard files that can be recreated. To ensure this is the case, please provide a complete list of the files in the folder of the virtual machine and attach the last file.log of vmware(from the virtual work computer) to a post response to view required details.

    André

  • How to make the SOAP request with the complex data types?

    Hi all

    I want to apply soap like that, how I can do this,


            string
            string


            dateTime
            dateTime

    string

    Thanks in advance.

    Any help?

  • How to create a custom data type

    Hello

    I'm using Labview 2009 and I am trying to create a custom data type and link it to the global variable that will be deployed in cRIO 9073. I couldn't find a method to achieve this. Please suggest a way to do this.

    Thank you

    Guilhem

    Right-click on a control and go to advanced-> customize.  This will open the control editor.  Change the type of a control to a Type def.  Customize if necessary and save the control.

  • deleting several lines in a report?

    db11gxe, apex 4.0, firefox 24,

    How to delete several lines in a report at the same time?

    Thank you

    Hi newbi_egy,

    Here's a demo with a few steps that can be used in your scenario-

    (1) this is the query for a report on the emp table that has column empno with values single-

    SELECT APEX_ITEM.CHECKBOX(1,empno) " ", ename, job FROM   emp ORDER  by 1
    

    (2) a button Delete is created that submits the page.

    (3) a sur-soumettre the process is created with point process on submit - after calculations and Validations to determine that the sub process is running when you click the button remove.

    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F01.count
    LOOP
    delete from emp where empno=APEX_APPLICATION.G_F01(i);
    END LOOP;
    END;
    

    I hope this could help you.

    Kind regards

    Das123

  • How to delete items from a cluster?

    Hello. I would like to know how to delete items from a cluster. I'm stuck with this problem. It has its own order of each element in a cluster. I tried to open a table, but it seems too complicated. In the attachment, I want to only get the data of 'flow' not 'pressure '. I try to use array programming, but it does not work. Would be nice if you help me to fix the file. Thank you

    Thank you very much. Your solution is way better than my confusing file.

  • How to deletions has selected list item from a list item.

    How delete a list item selected in a list item.

    My question that I should write to list_index so that it indicates the selected list item

    DELETE_LIST_ELEMENT (Nom_liste, list_index);

    -----
    Form of Oracle 10g

    Hello

    The trigger when-list-changed fires whenever the value has been changed.
    You get this value/index with the following:

    DECLARE
       LC$Liste  Varchar2(61) := :system.cursor_item ;
       LC$Valeur Varchar2(30) := Name_In( LC$Liste ) ;
       LN$Nbre   Pls_integer ;
    BEGIN
    
       LN$Nbre := Get_List_Element_Count( LC$Liste ) ;
    
       For i IN 1 .. LN$Nbre Loop
          If Get_List_Element_Value( LC$Liste, i ) = LC$Valeur Then
             -- you get the selected value, and index there --
             :BLOC2.LABEL := Get_List_Element_Label( LC$Liste, i ) ;
             Exit ;
          End if ;
       End loop ;
    
    END;
    

    François

  • How will I know where the time goes when you delete a line?

    Dear experts,

    Removal of certain rows in a table (approx. 4.9 GB / 2.9 Millon lines) takes an average of.5 seconds each line (on average).

    This table contains 3 clues, just I just rebuild. Statistics from a couple of the day before.

    I have imported/exported the table to a new schema and destruction prend.002 seconds each line (on average).

    How will I know where the time goes when you delete a line?

    BTW, this is ORACLE 10 g

    Thank you
    Serra

    There the child tables of this table with FK defined as DELETE CASCADE?

  • How to delete lines in pieces?

    How to remove 12,33,200 lines in the oracle table?
    I want to remove 10000 lines each time, otherwise, my rollback segment is not big enough to cope.
    Yes, is there some sort or an easy way to do it?

    Is anyway to do this in a single sql statement? I guess not. Correct me if I'm wrong :-)

    Thanks in advance!

    Published by: PhoenixBai on July 21, 2009 10:39

    PhoenixBai wrote:
    It's a way to do it, however, I would always ask "is there a better way than that?

    Yes. You can use the same approach in Oracle parallel query processing.

    Simplistically - a table has a data block and a block of data end start. You can calculate the physical address of the lines for a row of this table in the starting block. Similarly, you can calculate the last address of a row of this table in the end data block.

    You divide the range of data block start and end in several beaches - where each line has an equal number of data blocks. Assume that the table includes a 1000 data blocks. We create 5 ranges, each with 200 data blocks. Now, for each of these lines, we can determine what would be the rowid (physical address lines) for the first and last lines to this range of data block.

    We take our original SQL that will hit most of the lines in this table:

    delete from fooTable where col_n = :filter1
    

    We add a rowid range predicate to it:

    delete from fooTable where col_n = :filter1 and rowid between :1 and :2
    

    We can now start 5 process (in series or parallel) and to provide each of these with the physical ROWID calculated for 5 lines. Thus, each SQL get 200 blocks of data to deal with. As opposed to a single SQL that would have made all the data blocks of 1000.

    This approach only works if the SQL is similar to a full table scan - this means that your SQL will probably hit most of the lines in this table.

    Basic code for this approach was published in [this thread | http://forums.oracle.com/forums/thread.jspa?messageID=1534900#1534900]. (ignore the smiley in the code, which is assumed to be zero bindvariable, but is now rendered differently by the new version of Jive)

  • How to delete lines?

    How to delete rows from a table in a map?
    I need to get:

    DELETE FROM consumers
    WHERE col1 = parameter1
    AND col2 = parameter 2;

    col1 and col2 fail a primary/unique key in consumers

    Thnks,

    Hello

    put the parameters in a map before the table target, connect them with the target table, configure the type of loading of the table to delete, game by constraint: constraint, select the table col1, don't configure it: match when removing = Yes, same for Col. 2. Deploy and run the mapping.

    Look here for a demo: http://screencast.com/t/W61VGO4wAzi

    Kind regards
    Detlef

Maybe you are looking for

  • Cannot update video driver 4000 intel on my T530

    Hello, I have been seen and the BSOD problem and I was advided to possibly update my video driver through this site at least. The problem is that when I try to update it keep telling me that my phone does not meet the minimum requirements and he shou

  • PXI-6229 + LabVIEW

    Hi all I'm doing some tests with LabVIEW and I want to send the signal to analog voltage to a PXI-6229 (the chassis is an SMU-1071). I would like to know if I should add, in test programs I have, all controls to make the connection between Labview an

  • Send and receive mail with Outlook Express.

    I can receive email with outlook express, but can't open it. The message body is empty. I can't type in the area of the body to create messages. When you try to send a message I get this error message. "message cannot be sent because it has not been

  • Why my computer flashes constantly when I plugged my projector lcd for her?

    I installed the software.  However, when I plug in the projector, it begins to blink when I go to another screen or even use it.  I thought it was the projector; However, my computer is when I connected it to an another projector. What is going on? 

  • OMSA for ESXi 5.5

    Hello Are there plans when an OMSA for ESXi 5.5 is released? Current OMSA has only support for 5.1 and down. Thank you