Need to delete duplicate lines

I have two tables MEMBER_ADRESS and MEMBER_ORDER. The MEMBER_ADRESS has the lines duplicated in MEMBER_ID and MATCH_VALUE-based computing. These ADDRESS_IDs duplicate have been used in MEMBER_ORDER. I need to remove duplicates of MEMBER_ADRESS by making sure I keep one with PRIMARY_FLAG = 'Y' and update MEMBER_ORDER. ADDRESS_ID to the MEMBER_ADRESS. ADDRESS_ID I kept.

I'm on 11 GR 1 material

Thanks for the help.
CREATE TABLE MEMBER_ADRESS
(
  ADDRESS_ID               NUMBER,
  MEMBER_ID                NUMBER,
  ADDRESS_1                VARCHAR2(30 BYTE),
  ADDRESS_2                VARCHAR2(30 BYTE),
  CITY                     VARCHAR2(25 BYTE),
  STATE                    VARCHAR2(2 BYTE),
  ZIPCODE                  VARCHAR2(10 BYTE),
  CREATION_DATE            DATE,
  LAST_UPDATE_DATE         DATE,
  PRIMARY_FLAG             CHAR(1 BYTE),
  ADDITIONAL_COMPANY_INFO  VARCHAR2(40 BYTE),
  MATCH_VALUE              NUMBER(38) GENERATED ALWAYS AS (TO_NUMBER( REGEXP_REPLACE ("ADDITIONAL_COMPANY_INFO"||"ADDRESS_1"||"ADDRESS_2"||"CITY"||"STATE"||"ZIPCODE",'[^[:digit:]]')))
);


Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (200, 30, '11 Hourse Rd.', 
    '58754', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:10', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 1158754);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (230, 12, '101 Banks St', 
    '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:35:42', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (232, 12, '101 Banks Street', 
    '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:41:15', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (228, 12, '101 Banks St.', 
    '58487', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:38:19', 'MM/DD/YYYY HH24:MI:SS'), 'N', 10158487);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (221, 25, '881 Green Road', 
    '58887', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:34:18', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 88158887);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (278, 28, '2811 Brown St.', 
    '58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:36:11', 'MM/DD/YYYY HH24:MI:SS'), 'N', 281158224);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (280, 28, '2811 Brown Street', 
    '58224', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:45:00', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 281158224);
Insert into MEMBER_ADRESS
   (ADDRESS_ID, MEMBER_ID, ADDRESS_1, ADDRESS_2, ZIPCODE, CREATION_DATE, LAST_UPDATE_DATE, PRIMARY_FLAG, MATCH_VALUE)
 Values
   (300, 12, '3421 West North Street', 'x', 
    '58488', TO_DATE('08/11/2011 10:56:25', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('08/12/2011 10:42:04', 'MM/DD/YYYY HH24:MI:SS'), 'Y', 342158488);
COMMIT;


CREATE TABLE MEMBER_ORDER
(
  ORDER_ID    NUMBER,
  ADDRESS_ID  NUMBER,
  MEMBER_ID   NUMBER
);

Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (3, 200, 30);
Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (4, 230, 12);
Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (5, 228, 12);
Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (6, 278, 28);
Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (8, 278, 28);
Insert into MEMBER_ORDER
   (ORDER_ID, ADDRESS_ID, MEMBER_ID)
 Values
   (10, 230, 12);
COMMIT;

Chris:

In fact, it's a little meaner it seems at first glance, but it seems to work, at least on your sample data.

The update, based on the before and after the sample data.

SQL> SELECT * FROM member_adress;

ADDRESS_ID  MEMBER_ID ADDRESS_1              CREATION_DATE          LAST_UPDATE_DATE       P MATCH_VALUE
---------- ---------- ---------------------- ---------------------- ---------------------- - -----------
       228         12 101 Banks St.          08/11/2000 10:56:25 am 08/12/2005 10:38:19 am N    10158487
       230         12 101 Banks St           08/11/2000 10:56:25 am 08/12/2006 10:35:42 am N    10158487
       232         12 101 Banks Street       08/11/2000 10:56:25 am 08/12/2007 10:41:15 am N    10158487
       300         12 3421 West North Street 08/11/2000 10:56:25 am 08/12/2011 10:42:04 am Y   342158488
       221         25 881 Green Road         08/11/2000 10:56:25 am 08/12/2011 10:34:18 am Y    88158887
       278         28 2811 Brown St.         08/11/2000 10:56:25 am 08/12/2006 10:36:11 am N   281158224
       280         28 2811 Brown Street      08/11/2000 10:56:25 am 08/12/2011 10:45:00 am Y   281158224
       200         30 11 Hourse Rd.          08/11/2000 10:56:25 am 08/12/2005 10:34:10 am Y     1158754

SQL> SELECT * FROM member_order
  2  ORDER BY member_id, order_id;

  ORDER_ID ADDRESS_ID  MEMBER_ID
---------- ---------- ----------
         4        228         12
         5        230         12
        10        230         12
        11        232         12
        12        300         12
         6        278         28
         8        278         28
         3        200         30

SQL> UPDATE member_order mo
  2  SET address_id = (SELECT address_id
  3                    FROM (SELECT address_id, member_id, match_value
  4                          FROM (SELECT address_id, member_id, match_value,
  5                                        ROW_NUMBER () OVER (PARTITION BY member_id, match_value
  6                                                            ORDER BY CASE WHEN primary_flag = 'Y' THEN 1
  7                                                                          ELSE 2 END,
  8                                                                    GREATEST(NVL(creation_date,TO_DATE('1/1/0001','MM/DD/YYYY')),
  9                                                                             NVL(last_update_date,TO_DATE('1/1/0001','MM/DD/YYYY'))) desc) rn
 10                                FROM member_adress)
 11                          WHERE rn = 1) ma
 12                    WHERE mo.member_id = ma.member_id and
 13                          ma.match_value = (SELECT match_value from member_adress maa
 14                                            WHERE maa.address_id = mo.address_id));

SQL> SELECT * FROM member_order
  2  ORDER BY member_id, order_id;

  ORDER_ID ADDRESS_ID  MEMBER_ID
---------- ---------- ----------
         4        232         12
         5        232         12
        10        232         12
        11        232         12
        12        300         12
         6        280         28
         8        280         28
         3        200         30

Then to remove it, something like:

SQL> DELETE FROM member_adress
  2  WHERE rowid NOT IN (SELECT rowid
  3                      FROM (SELECT rowid,
  4                                   ROW_NUMBER () OVER (PARTITION BY member_id, match_value
  5                                                       ORDER BY CASE WHEN primary_flag = 'Y' THEN 1
  6                                                                     ELSE 2 END,
  7                                                                GREATEST(NVL(creation_date,TO_DATE('1/1/0001','MM/DD/YYYY')),
  8                                                                         NVL(last_update_date,TO_DATE('1/1/0001','MM/DD/YYYY'))) desc) rn
  9                            FROM member_adress)
 10                          WHERE rn = 1);

SQL> SELECT * FROM member_adress;

ADDRESS_ID  MEMBER_ID ADDRESS_1              CREATION_DATE          LAST_UPDATE_DATE       P MATCH_VALUE
---------- ---------- ---------------------- ---------------------- ---------------------- - -----------
       232         12 101 Banks Street       08/11/2000 10:56:25 am 08/12/2007 10:41:15 am N    10158487
       300         12 3421 West North Street 08/11/2000 10:56:25 am 08/12/2011 10:42:04 am Y   342158488
       221         25 881 Green Road         08/11/2000 10:56:25 am 08/12/2011 10:34:18 am Y    88158887
       280         28 2811 Brown Street      08/11/2000 10:56:25 am 08/12/2011 10:45:00 am Y   281158224
       200         30 11 Hourse Rd.          08/11/2000 10:56:25 am 08/12/2005 10:34:10 am Y     1158754

John

Tags: Database

Similar Questions

  • Deleting duplicate lines

    Hello
    We need help removing duplicate rows from a table please.

    We get the following table:
    SSD@ermd> desc person_pos_history
     Name                                                                     Null?    Type
     ------------------------------------------------------------------------ -------- ------------------------
    
     PERSON_POSITION_HISTORY_ID                                               NOT NULL NUMBER(10)
     POSITION_TYPE_ID                                                         NOT NULL NUMBER(10)
     PERSON_ID                                                                NOT NULL NUMBER(10)
     EVENT_ID                                                                 NOT NULL NUMBER(10)
     USER_INFO_ID                                                                      NUMBER(10)
     TIMESTAMP                                                                NOT NULL DATE
    We discovered that rare person_id repeated for a particular event (3):
    select PERSON_ID, count(*)
    from person_pos_history
    group by PERSON_ID, EVENT_ID
    having event_id=3
         and count(*) > 1
    order by 2
    
     PERSON_ID   COUNT(*)
    ---------- ----------
        217045        356
        216993        356
        226198        356
        217248        364
        118879        364
        204471        380
        163943        384
        119347        384
        208884        384
        119328        384
        218442        384
        141676        480
        214679        495
        219149        522
        217021        636
    If we look at the id of the person 1 "217045", we can see that he repeats 356 times for event id 3.
    SSD@ermd> select POSITION_ASSIGNMENT_HISTORY_ID, POSITION_TYPE_ID, PERSON_ID,EVENT_ID, to_char(timestamp, 'YYYY-MM-DD HH24:MI:SS')
      2  from person_pos_history
      3  where EVENT_ID=3
      4  and person_id=217045
      5  order by timestamp;
    
       PERSON_POSITION_HISTORY_ID  POSITION_TYPE_ID  PERSON_ID   EVENT_ID TO_CHAR(TIMESTAMP,'
    ------------------------------ ---------------- ---------- ---------- -------------------
                            222775               38     217045         03 2012-05-07 10:29:49
                            222774               18     217045         03 2012-05-07 10:29:49
                            222773                8     217045         03 2012-05-07 10:29:49
                            222776                2     217045         03 2012-05-07 10:29:49
                            300469               18     217045         03 2012-05-07 10:32:05
    ...
    ...
                           4350816               38     217045         03 2012-05-08 11:12:43
                           4367970                2     217045         03 2012-05-08 11:13:19
                           4367973                8     217045         03 2012-05-08 11:13:19
                           4367971               18     217045         03 2012-05-08 11:13:19
                           4367972               38     217045         03 2012-05-08 11:13:19
    
    356 rows selected.
    It is prudent to assume that the event id per person with the earlier timestamp id is the one who was in charge of 1st, as a result, we want to keep and the rest should be deleted.

    You kindly help us with the sql for the removal of duplicates please.

    Concerning

    Hello

    rsar001 wrote:
    ... We must maintain a row of data for each unique position_type_id. The query you provided with gratitude deletes lines keep them all not only one line for the id of the person 119129 regardless of which is the position_type_id.

    In fact, the statement that I posted earlier maintains a line for each separate person_id combnination and event_id; This is what means the analytical PARTITION BY clause. That made this assertion would be clearer if you had a different sample of the value. You posted a rather large set of samples, about 35 lines, but each row has the same person_id, and each row has the same event_id. In your real table, you probably have different values in these columns. If so, you should test with data that looks more like your real table, with different values in these columns.

    How can we change the query so that it holds the position_type_id County please before you delete the duplicate rows.

    You can include positiion_type in the analytical PARTITION BY clause. Maybe that's what you want:

    ...     ,     ROW_NUMBER () OVER ( PARTITION BY  person_id
                                   ,                    event_id
                             ,             position_type     -- *****  NEW  *****
                             ORDER BY        tmstmp
                           )         AS r_num
    ...
    

    CREATE TABLE and staements of INSERTION for the sample data and desired outcomes from these data, I'm only guessing.

  • Deleting duplicate line

    Hello

    I have a delicate situation.

    my query is like this:
    select count(*), source, ttype, tdate, qty, rate, cost, charge, impstatus, errorcode, proj_code, res_code, role_code, job_id, extl_id, taskid, rate_curr, cost_curr,ext_source_id, chg_code, inp_type
    from transimp
    where ttype = 'X'
    and res_code = 'NLAB'
    and tdate >= '01-MAR-2009'
    group by source, ttype, tdate, qty, rate, cost, charge, impstatus, errorcode, proj_code, res_code, role_code, job_id, extl_id, taskid, rate_curr, cost_curr,ext_source_id, chg_code, inp_type
    having count(*) > 1
    This query returns me 700 records with count (*) = 3
    which means that they are duplicates of records in the table (Please note we have a primary key, but these documents are double according to the needs of the company).

    I want to remove these duplicates, i.e. after the deletion if I run the same query again, count (*) must be 1.

    any thoughts?

    Thanks in advance.

    Dear Caitanya!

    It is a DELETE statement that deletes duplicate rows:

    
    DELETE FROM our_table
    WHERE rowid not in
    (SELECT MIN(rowid)
    FROM our_table
    GROUP BY column1, column2, column3... ;
    

    Here Column1, Column2, Column3 is the key for each record.
    Be sure to replace our_table with the name of the table for which you want to remove duplicate rows. GROUP BY is used on the columns making up the primary key of the table. This script deletes every line in the group after the first row.

    I hope this could be of help to you!

    Yours sincerely

    Florian W.

  • Delete duplicate lines

    Hello

    I have the following structure
    ID     txndate         ItemNumber batch     gain  locator
    --     ------------    --------   --------  ----- ---------
    1      15/05/2011      710        230       20    L123
    2      15/05/2011      710        230       20    L123
    3      19/05/2011      410        450       70    L456
    4      05/05/2011      120        345       60    L721
    5      05/05/2011      120        345       60    L721
    6      05/05/2011      120        345       60    L721
    7      15/06/2012      840        231       40    L435
    8      15/05/2011      710        230       20    L123
    9      15/05/2011      710        230       20    L123
    I need to come up with a query that will remove all but one of the duplicate as follows:
    ID txndate    ItemNumber batch gain locator
    -- -------    ---------- ----- ---- -------
    1  15/05/2011 710        230   20   L123
    3  19/05/2011 410        450   70   L456
    4  05/05/2011 120        345   60   L721
    7  15/06/2012 840        231   40   L435
    8  15/05/2011 710        230   20   L123 <== Note this - it needs to appear in 2 places
    Thank you

    PS: My apologies for not being able to shape the structure of the table enough but I guess that it conveys the idea.

    Published by: user3214090 on January 28, 2013 07:22

    Based on the sample paper & pencil - no database at hand :(

    ID     txndate         ItemNumber batch     gain  locator x    y    z
    4      05/05/2011      120        345       60    L721    1    3    1
    5      05/05/2011      120        345       60    L721    2    3    2
    6      05/05/2011      120        345       60    L721    3    3    3
    1      15/05/2011      710        230       20    L123    1    0    1
    2      15/05/2011      710        230       20    L123    2    0    2
    8      15/05/2011      710        230       20    L123    3    5    1
    9      15/05/2011      710        230       20    L123    4    5    2
    3      19/05/2011      410        450       70    L456    1    2    1
    7      15/06/2012      840        231       40    L435    1    6    1
    

    Tabibitosan {message: id = 9535978} aka fixed the difference method should be used (groups - there - must first be generated) NO TESTS!

    select id,txndate,itemnumber,batch,gain,locator
      from (select id,txndate,itemnumber,batch,gain,locator,
                   row_number() over (partition by y order by id) z
              from (select id,txndate,itemnumber,batch,gain,locator,
                           id - row_number() over (partition by txndate,itemnumber,batch,gain,locator
                                                       order by id
                                                  ) y
                      from the_table
                   )
           )
     where z = 1
    

    Concerning

    Etbin

  • I have verticle colored lines - from the bottom to the 1/2 in screen - I can see through them to read - I need to know the WAY to delete these lines

    I mâtinées verticle lines - from the bottom to the 1/2 in screen - I can see through them to read - I need to know the WAY to delete these lines - I once, a few years ago, removed, but they reappear - not my conscious fault - this is my old computer - A Compac - Windows 95 as an operating system

    Hello

    You should check with Support of Compaq, their documentation online and drivers,
    and ask in their forums about known issues.

    Microsoft product support has ended for Windows 95 a decade ago.

    Compaq - support, drivers and documentation online
    http://www.Compaq.com/country/cpq_support.html

    Compaq (HP) - Forums
    http://h30434.www3.HP.com/PSG/|

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • change the size of the table and remove the duplicate line

    Hello

    I run a program that does a for loop 3 times.  In each loop, the data are collected for x and y points (10 in this example).  How can I output the table with 30 points in a simple 2D array (size 2 x 30)?

    Moreover, from the table, how to delete duplicate rows that contain the same value of x?

    Thank you

    hiNi.

    He probaibly which would have allowed to attach a file that has a consecutive duplicate lines.

    Here is a simple solution.

  • eliminate duplicate lines

    Hello

    I have a report that shows some of the duplicate records and need to eliminate duplicate rows on the report. How to hide the lines duplicated on the presentation of the report so that only 1 row appears on the report instead of having the same line appearing more than once? I use BI Publisher 11.1.1.7. Thank you.

    It is advisable to eliminate duplicate rows to the data model, however, if you do not want to do it on the model please see below

    Whereas you use RTF model

    Change your for each tag to something like this

    If you don't succeed; Thanks for posting your model and an example of xml data

  • I use Dreamweaver cc 2014 and after styling css to my fluid page layout grid I lose him resize, delete, duplicate and move up / down ability.

    I use Dreamweaver cc 2014 and after styling css to my fluid page layout grid I lose him resize, delete, duplicate a high displacement / low capacity.

    For this reason I can't build new pages by copying a page to create a new one.

    I have a third style sheet that I use for the styles of navigation and h1 - h6 ect. Tags. and I'm also using a dropdown menu CSS, if one of them can be the problem?

    The menu css that I use has the following script: I spend at the bottom of the html page. Before the closing tag, body

    < script >

    $(function () {})

    $("#nav").tinyNav ();

    });

    < /script >

    I also use the following for an image - I have put it to the top of the fluid

    grid style sheet.

    * {

    box-sizing: border-box; / * Opera/IE 8 + * /.

    -moz-box-sizing: border-box; / * Firefox, another Gecko * /.

    -webkit-box-sizing: border-box; / * Safari/Chrome, another WebKit * /.

    }

    Can you please help.

    My experience is that you should not touch the style sheets that have been created by the system of FGL. Also, there is no need to copy and paste whenever it could disrupt the spoilsports. If you need to apply your own styles and then put them in a second stylesheet, that way if something goes wrong, you can always revert to the original.

  • Help needed - function Delete of ADF

    Hi Experts ADF,

    I'm very big thing back to ADF programming (just 3 weeks exp.), I have a requirement to remove the table row. I use jDev 11g. When I press the button delete it should request confirmation YesNo, if she does so I need to delete and validate. Please find my code below:

    Command button:

    < af:commandToolbarButton actionListener = "#{bindings." Delete.Execute text}"="Remove"binding =" #{backingBeanScope.backing_Home.ctb2} "id ="ctb2">"

    < af:showPopupBehavior popupId = "p8" / >

    < / af:commandToolbarButton >

    Popup:

    < af:popup binding = "#{backingBeanScope.backing_Home.p8}" id = "p8" > "

    < af:dialog binding = "#{backingBeanScope.backing_Home.d2}" id = "d2" title = 'Do you want to delete selected line?' titleIconSource = 'Remove a line' type = 'yesNoCancel"dialogListener =" # ""

    {backingBeanScope.backing_Home.DeleteConfirmation}"/ >}

    < / af:popup >

    Java class:

    public void DeleteConfirmation (DialogEvent dialogEvent) {}

    If (dialogEvent.getOutcome ()! = DialogEvent.Outcome.yes) {}

    return;

    } else {}

    try {}

    BindingContainer links = getBindings();

    String oprb = bindings.getOperationBinding("Delete").toString ();

    OperationBinding deleteBinding = bindings.getOperationBinding ("Delete");

    OperationBinding commitBinding = bindings.getOperationBinding ("Commit");

    Object result = deleteBinding.execute ();

    If (! deleteBinding.getErrors () .isEmpty ()) {}

    return;

    }

    Object commitResult = commitBinding.execute ();

    If (! commitBinding.getErrors () .isEmpty ()) {}

    return;

    }

    return;

    } {} catch (NullPointerException only)

    System.out.println ("NullPointerException:" + no);

    } catch (Exception ex) {}

    System.out.println ("Exception:" + ex);

    }

    Here, I'm getting nullpointer exception on 'OperationBinding deleteBinding = bindings.getOperationBinding("Delete");'

    Please help me solve this problem...

    I thank in advance...

    Have you added to the page linking actions remove and commit?

  • 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

  • deleting duplicate records

    I'm doing all the records in the small suitcase to eliminate the sensitivity of the data to display for example

    (1) setting a day email set email = lower (email); who gives a unique constraint error

    (2) I saw emails in duplicate with the following command
    Select E-mail
    enamel
    where lower (email) in
    (select lower (email)
    enamel
    Lower group (email)
    view count (*) > 1) order by e-mail CSA;

    (3) I want to delete duplicate entries as described in (2) with the sql statement because they are over 500 and if I start to remove manually it will take too much of my time

    Thank you and best regards
    SQL> create table t(email varchar2(100))
      2  /
    
    Table created.
    
    SQL> create unique index t_idx on t(email)
      2  /
    
    Index created.
    
    SQL> insert into t values('[email protected]')
      2  /
    
    1 row created.
    
    SQL> insert into t values('[email protected]')
      2  /
    
    1 row created.
    
    SQL> insert into t values('[email protected]')
      2  /
    
    1 row created.
    
    SQL> insert into t values('[email protected]')
      2  /
    
    1 row created.
    
    SQL> insert into t values('[email protected]')
      2  /
    
    1 row created.
    
    SQL> commit
      2  /
    
    Commit complete.
    
    SQL> select * from t
      2  /
    
    EMAIL
    ----------------------------------------------------------------------------------------------------
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    [email protected]
    
    SQL> update t set email = lower(email)
      2  /
    update t set email = lower(email)
    *
    ERROR at line 1:
    ORA-00001: unique constraint (SYSADM.T_IDX) violated
    
    SQL> delete
      2    from t
      3   where rowid not in (select rowid
      4                    from (select rowid,row_number() over(partition by lower(email) order by lower(email)) rno
      5                            from t)
      6                   where rno = 1)
      7  /
    
    3 rows deleted.
    
    SQL> update t set email = lower(email)
      2  /
    
    2 rows updated.
    
    SQL> select * from t
      2  /
    
    EMAIL
    ----------------------------------------------------------------------------------------------------
    [email protected]
    [email protected]
    
    SQL>
    
  • I need to delete old email addresses in the address cache

    I need to delete old addresses of e-mail addresses collected and personal address books. What does not work (final deletion; addresses not back when Thunderbird is opened later): 1) right-click and delete; (2.) to write a new email... address list comes on the right pane on the left... click and remove the address e-mail. (3.) what has been suggested in discussion forums about this EXACT, SPECIFIC... with THUNDERBIRD problem. I'm running the 24.4.0 release version. Once more, how do I permanently delete unwanted messages treats (in an address book, "AutoComplete cache", etc.--pick you). Thank you.

    https://support.Mozilla.org/en-us/questions/993430#answer-553080

  • I need to number the lines of my page document for the presentation of the journal. Help, please!

    I need to number the lines of a document to be submitted to a journal. I can make a section in the document, but I can't find a command, and then add the line numbers.

    Hi Misha,.

    3 pages includes number of words to display as a menu item in the view menu:

    The County appears at the bottom left of the page and it shows more options when you click on it. Unfortunately, "number of lines" is not included in the available options:

    If you had ' 09 Pages on your Mac and did not intentionally removed it when you installed 5 Pages, it will always be there, in a folder named iWork ' 09, in your Applications folder.

    Copy your document, open the Pages ' 09 and paste the contents of your document into a word processor new document in Pages ' 09.

    Check that the end of the document is delivered on the same page (number) and to the same position on this page as in the original and making small changes at the margin to adjust it if necessary.

    Then go to edit > tools > statistics to see this more comprehensive report:

    Note that if you need to present the newspaper article in one format other than a file of Pages, the number of rows may change due to changes in the conversion to the new format of formatting.

    If you don't have a Pages ' 09, you can get a number of lines using tools > line numbers in OpenOffice or LibreOfficeApache. Both are applications open source, free to download and use (even if you might donate help the future evolution of the demand). The links will take you to their respective Web sites.

    Oh... One more thing (as long as Steve jobs used to say sometimes): pages (3), go (menu) Pages > provide pages of comments and make a feature request so that the line count (and line numbering) added the capability of 3 Pages.

    Kind regards

    Barry

  • I need to delete Spamfighter-HOW?

    I need to delete Spamfighter-HOW?

    Learn how to use Google:
    http://www.Google.com/search?q=delete+SPAMfighter&ie=UTF-8

  • When you are working in photoshop, a message telling me that I need to delete my "scratch disk" appears. What and how can I do this?

    When you are working in photoshop, a message telling me that I need to delete my "scratch disk" appears. What and how can I do this?

    Hello

    You should check with Support Adobe and their Forums.

    Adobe support
    http://www.Adobe.com/support/

    PhotoShop - Forums
    http://forums.Adobe.com/community/Photoshop

    I hope this helps.

Maybe you are looking for