Counting duplicates

I have a query that is returning some rows with duplicate information:
SELECT A, B from SOME_TABLE order by A, B:
A           B
=========== =========
something   some value
else        some value
repeat      info
repeat      info
repeat      infoI would like to add a column C that has the duplication count:
A           B           C
=========== =========   ===
something   some value  1
else        some value  1
repeat      info        1
repeat      info        2
repeat      info        3any help would be greatly appreciated!

Perfect - the specific use case was to compute the OVERLOAD number
for functions/procedures in a package that have the same name:
SELECT OBJECT_NAME, PROCEDURE_NAME, OVERLOAD FROM
(SELECT OBJECT_NAME, PROCEDURE_NAME, row_number() over (partition by
OBJECT_NAME, PROCEDURE_NAME order by OBJECT_NAME) OVERLOAD
FROM USER_PROCEDURES)
OBJECT_NAME            PROCEDURE_NAME             OVERLOAD 
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         1        
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         2        
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         3        
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         4        
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         5        
ANOTHEREMPLOYEEPKG     ANOTHERGETEMPLOYEE         6        
ANOTHEREMPLOYEEPKG     GETOSUSERFUNCTION          1        
EMPLOYEE_PKG           GETEMPLOYEENAME            1        
GETBARBLOBBYID         (null)                     1        
GET_EMPLOYEES_BY_PROV  (null)                     1        
GET_VEE_ARRAY_EMP      (null)                     1        
GET_VEE_ARRAY_EMPS     (null)                     1        
INOUT_TEST             (null)                     1        
NOARGS_TEST            (null)                     1        
RAW_TEST               (null)                     1        
SELECTALLEMPLOYEES     (null)                     1        
SELECTALLXREMPLOYEES   (null)                     1        
SOME_PKG               GETEMPLOYEEBYEMPNO_DEPTNO  1        
SOME_PKG               GETOSUSERFUNCTION          1        
SP_TEST                (null)                     1        
UPDATE_VEE_ARRAY_PHS   (null)                     1        
VARCHAR_TEST           (null)                     1        

Similar Messages

  • Counting duplicates in a big table

    Dear all,
    We are counting the number of duplicate records in a table as follows :
    SELECT COUNT (*)
    FROM semateam b
    WHERE cdate < '02-apr-09'
    AND ROWID IN (
    SELECT MAX (ROWID)
    FROM incalls a
    WHERE a.cdate = b.cate
    AND a.bno = b.bno
    AND a.b_suno = b.b_subno
    AND a.c_type = b.c_type
    AND a.calldn = b.calldn
    AND a.bamt = b.bamt
    AND a.preb = b.preb
    AND a.postb =b.postb
    GROUP BY a.cdate,
    a.subno,
    a.b_no,
    a.calldn,
    a.c_e,
    bamt,
    preb,
    postb
    HAVING COUNT (*) > 1)
    The table seamteam has got 8 million rows which is properly indexed. please let me have your suggestion inorder to tune it ?
    OS : solaris 5.10
    DB : 10.2.0.4.
    Kai

    HI..
    What is the explain plan of the query.To check the duplicate rows you can refer to below links:-
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:15258974323143]
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004]
    Anand

  • Counting duplicate records in a table

    Hi,
    I have to display duplicate records in a table,but the table name and column should be passed dynamically(In procedure). Please let me know the query for this.

    Try this one, is used to find the duplicate value from table
    Type: I
    SELECT * FROM employees e1 WHERE rowid> (SELECT min(rowid)
    FROM employees e2 WHERE e1.department_id=e2.department_id);
    Type: II
    SELECT * FROM my_table t1 WHERE EXISTS (SELECT 'x' FROM my_table t2
    WHERE t2.key_value1 = t1.key_value1
    AND t2.key_value2 = t1.key_value2
    AND t2.rowid > t1.rowid);
    Type: III
    SELECT count(*), empn FROM empmast_dum
    GROUP BY empn HAVING count(*) >1 ORDER BY empn;
    Type: IV
    SELECT dep, name,net,RANK() OVER (PARTITION BY dep ORDER BY net) rank
    FROM empmast_dump
    WHERE dep=04;
    Type: V
    SELECT empn FROM empmast_dump
    WHERE empn NOT IN(SELECT MIN(empn)
    FROM empmast_dump GROUP BY NAME;
    I have to display duplicate records in a
    table,but the table name and column should be passed
    dynamically(In procedure). Please let me know the
    query for this.When you need to pass table name dynamically in your procedure ,
    just enter table name as substitution variable or bind variable, if u want to know about
    this, read here
    venki
    http://venki-hb.blogspot.com/2008/02/basic-sql-query-tips.html

  • How to count duplicates

    Lookin for a formula that will help me count when the value in Column A remains the same in Column C. Example below 3 rebates values remained the same so there is no loss or savings taking place. I need a count on my entire sheet to see how often this is occuring. Any help appreciated!
    Column(A) Prior Quater Rebate   Column(B) Current Quarter     Column(C) Current Quarter Rebate
    150.00                                         2013Q4                              175.00
    153.00                                         2013Q4                              160.00
    150.00                                         2013Q4                              150.00
    120.00                                         2013Q4                              155.00
    120.00                                         2013Q4                              115.00
    150.00                                         2013Q4                              150.00
    125.00                                         2013Q4                              125.00                                            

    the easiest way (in my opinion) is the sum the values in column A, then sum the values in column C then take the difference.
    Add a footer row to your table by selecting the table then click the add footer button in the tool bar (top right):
    In the footer add the formulas as follows:
    A10=SUM(A)
    C10=SUM(C)
    D10=C10-A10
    if you want a more binary answer in D10 you could also enter:
    D10=IF((C10-A10) >0, "You saved money", "You did not save any money")

  • Count duplicates

    I want to select all state codes with multiple pack_size. Example is state_code 3737 with pack_size of 5 and 6.
    state_code pack_size
    3729     12
    3733     3
    3734     12
    3735     120
    3737     5
    3737     6
    3756     12
    3756     11

    or
    SQL> with t as
      2  (select 3729 state_code, 12 pack_size from dual
      3   union all
      4   select 3733, 3 from dual
      5   union all
      6   select 3734, 12 from dual
      7   union all
      8   select 3735, 120 from dual
      9   union all
    10   select 3737, 5 from dual
    11   union all
    12   select 3737, 6 from dual
    13   union all
    14   select 3756, 12 from dual
    15   union all
    16   select 3756, 11 from dual)
    17  select a.state_code,
    18         pack_size
    19    from (select state_code,
    20                 pack_size,
    21                 count(*) over (partition by state_code) cnt
    22            from t) a
    23   where a.cnt > 1;
    STATE_CODE  PACK_SIZE
          3737          5
          3737          6
          3756         12
          3756         11
    SQL> slightly different from what nicholas posted without using the order by clause

  • How can count Duplicate value in column?

    Regards:
    M K SINGH

    Like this:
    SQL> create table t(a number);
    Table created.
    SQL> insert into t values (1);
    1 row created.
    SQL> insert into t values (2);
    1 row created.
    SQL> insert into t values (2);
    1 row created.
    SQL> insert into t values (3);
    1 row created.
    SQL> insert into t values (4);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t;
             A
             1
             2
             2
             3
             4
    SQL> select a, count(*) from t group by a;
             A   COUNT(*)
             1          1
             2          2
             4          1
             3          1
    SQL>

  • Counting the duplicate entries without looping itab.

    Hi ,
    I want to count the duplicate entries in  itab without looping
    the itab.
    can any one help me....

    If you just want to know the number of duplicate entries:
    DATA:
      zlt_itab1 TYPE ....
      zlt_itab2 LIKE itab1,
      zlv_lines TYPE i,
    *-Copy table
    zlt_itab2 = zlt_itab1
    *-Sort on field to count duplicates:
    SORT zlt_itab2 BY <field for counting duplicates>
    *-Total number of lines:
    zlv_lines = LINES( zlt_itab2).
    *-Remove duplicates:
    DELETE ADJACENT DUPLICATES FROM zlt_itab2.
    *-Calculate number of duplicates:
    zlv_lines = zlv_lines - LINES(zlt_itab1).
    Regards,
    John.

  • How do I find duplicate words in a Numbers spreadsheet?

    Hello, I've created my first document on Numbers and am trying to figure out how to find duplicate words. Ideally, a list of words that repeat in the document and how many times. Is this possible? Thank you in advance for the advice

    It's easy enough to find and count duplicate entries, especially if they are all in a single column, but if you want to count individual words within multi word entries, the problem is more complicated.
    Here's an example for the 'simple' case, using a familiar 155 word passage from English literature.
    The words in the passage are separated into a single line for each word, and stripped of all punctuation. This may be done in Pages, or in Text edit, or in pretty much any word processing software or text editor. Paste the passage into a WP or text document, then use the application's Find/Replace feature to replace all of the spaces with returns. I would also do a second pass replacing all double returns with single returns, then repeat that until Find/Replace reported replacing zero occurrences.
    Punctuation was stripped using Find/Replace
    The prepared list was pasted into column A of a Numbers table.
    Formulas:
    B2: =COUNTIF($A$1:A2,A2)
    C2: =IF(AND(B>1,B=COUNTIF($A,A2)),ROW()-1,999999)
    Fill both down their respective columns to the end of the table.
    The small table is inserted as a Basic table using the Tables button. It contains a Header row, but no Header columns.
    Formula:
    A2: =IFERROR(OFFSET(Table 1 :: $A$1,SMALL(Table 1 :: $C,ROW()-1),COLUMN()-1),"")
    Fill right into B2, then fill both down to the end of the table.
    Descriptions of the functions used, along with their syntax and at least one example of their use in a table are available in the Numbers '09 User Guide, which may be downloaded via the Help menu in Numbers.
    Regards,
    Barry
    PS: Regards to the late Mr. Shakespeare, and thank you for providing the text used.

  • PowerShell script to find and remove duplicate items from document library

    Hi Friends,
    Please check this below script, It is finding the duplicate items and removing it. This script is not working to find the duplicate items from document
    library and remove. Can you please let me know where it is wrong.
    Add-PSSnapin microsoft.sharepoint.powershell 
    $web = Get-SPWeb -Identity "http://zapltvsspdev02:4333/bu/EXCO" 
    $list = $web.Lists["AECI Documents"] 
    $AllDuplicates = $list.Items.GetDataTable() | Group-Object INumber | where {$_.count -gt 1} 
    $count = 1 
    $max = $AllDuplicates.Count 
    foreach($duplicate in $AllDuplicates) 
    $duplicate.group | Select-Object -Skip 1 | % {$list.GetItemById($_.ID).Delete()} 
    Write-Progress -PercentComplete ($count / $max * 100) -Activity "$count duplicates removed" -Status "In Progress" 
    $count++ 
    Remove-PsSnapin Microsoft.SharePoint.PowerShell
    Note:
    In the above code, duplicates are found using the "INumber" column. 
    valmiki

    check this
    http://stackoverflow.com/questions/21337158/delete-duplicate-items-in-sharepoint-list

  • Duplicate entries in    alv.

    Hi all,
        In my ALV report, i have so many fields having duplicate entry. (ex: ecc no. ,ern no. vat no. , central sales tax no., LST no., telephone no., name...so many )
        what my requirement is ... for each duplicate record i want to display the count
    against to that record for the par field. so for evry field ..it will be followed by duplicate count field also. How to do this with minimum number of loops.

    i am sending my program. i have to find out duplicate entries not only for name but alos for serch term, fax no, ecc no, cstno, lst no., panno. .and i need to display that against to every record.
    suppose
    i have
    name       search term     
    aaa           a                    
    aaa           b                    
    bbb           b                    
    so i have to sort the abov one
    name duplicate  search term  duplicte
    aaa                       a              
    aaa      2               b
    bbb                       b                     2
    how to do this.
    in the following code , i tried for name but its not giving me the count.please help me.
    TYPE-POOLS: slis.
    TABLES : lfa1, j_1imovend.
    TYPES : BEGIN OF ty_lfa1,
            lifnr TYPE lifnr,
            name1 TYPE name1_gp,
            name2 TYPE name2_gp,
            ort01 TYPE ort01_gp,   "city
            pstlz TYPE pstlz,      "postal code
            regio TYPE regio,
            sortl TYPE sortl,      "search term
            stras TYPE stras_gp,   "street
            adrnr TYPE adrnr,      "address
            erdat TYPE erdat_rf,   "created on
            ernam TYPE ernam_rf,   "created by
            ktokk TYPE ktokk,      "account group
            loevm TYPE loevm_x,    "del. flag
            sperr TYPE sperb_x,    "posting block
            sperm TYPE sperm_x,    "Centrally imposed purchasing block
            telf1 TYPE telf1,      "First telephone number
            telf2 TYPE telf2,      "Second telephone number
            telfx TYPE telfx,      "Fax Number
            stceg TYPE stceg,      "VAT registration number
            sperq TYPE qsperrfkt,  "Function to block
            END OF ty_lfa1.
    DATA : it_lfa1 TYPE TABLE OF ty_lfa1.
    DATA : wa_lfa1 TYPE ty_lfa1.
    TYPES : BEGIN OF ty_j_1imovend,
            lifnr      TYPE lifnr,
            j_1iexcd  TYPE j_1iexcd,  "ECC Number
            j_1iexrn  TYPE j_1iexrn,  "Excise Registration Number
            j_1iexrg  TYPE j_1iexrg,  "Excise Range
            j_1iexdi  TYPE j_1iexdi,  "Excise Division
            j_1icstno TYPE j_1icstno, "Central Sales Tax Number
            j_1ilstno TYPE j_1ilstno, "Local Sales Tax Number
            j_1ipanno TYPE j_1ipanno, "Permanent Account Number
            j_1ivtyp  TYPE j_1ivtyp,  "Type of Vendor
            END OF ty_j_1imovend.
    DATA : it_j_1imovend TYPE TABLE OF ty_j_1imovend.
    DATA : wa_j_1imovend TYPE ty_j_1imovend.
    TYPES: BEGIN OF ty_final,
           lifnr TYPE lifnr,
           name1 TYPE name1_gp,
           vname TYPE name1_gp,    "name1 without spl char
           count_name TYPE i,
           name2 TYPE name2_gp,
           ort01 TYPE ort01_gp,   "city
           pstlz TYPE pstlz,      "postal code
           regio TYPE regio,      "region
           sortl TYPE sortl,      "search term
           vsortl TYPE sortl,      "search term without spl char
           count_sortl TYPE i,
           stras TYPE stras_gp,   "street
           adrnr TYPE adrnr,      "address
           erdat TYPE erdat_rf,   "created on
           ernam TYPE ernam_rf,   "created by
           loevm TYPE loevm_x,    "del. flag
           sperr TYPE sperb_x,    "posting block
           sperm TYPE sperm_x,    "Centrally imposed purchasing block
           telf1 TYPE telf1,      "First telephone number
           vtelf1 TYPE telf1,     "tel no. with numbers only
           telf2 TYPE telf2,      "Second telephone number
           telfx TYPE telfx,      "Fax Number
           vtelfx TYPE telfx,     "fax no . without spl char.
           count_fax TYPE i,
           stceg TYPE stceg,         "VAT registration number
           sperq TYPE qsperrfkt,  "Function to block
           j_1iexcd  TYPE j_1iexcd,  "ECC Number
           veccno TYPE j_1iexcd,  "ecc without spl char
           count_ecc TYPE i,
           j_1iexrn  TYPE j_1iexrn,  "Excise Registration Number
           count_ern TYPE i,
           j_1iexrg  TYPE j_1iexrg,  "Excise Range
           j_1iexdi  TYPE j_1iexdi,  "Excise Division
           j_1icstno TYPE j_1icstno, "Central Sales Tax Number
           vcstno TYPE j_1icstno,  "Cst without spl char
           count_cst TYPE i,
           j_1ilstno TYPE j_1ilstno, "Local Sales Tax Number
           vlstno TYPE j_1ilstno, " LST without spl char
           count_lst TYPE i,
           j_1ipanno TYPE j_1ipanno, "Permanent Account Number
           vpanno TYPE j_1ipanno,  "Pan without spl char
           count_pan TYPE i,
           j_1ivtyp  TYPE j_1ivtyp,  "Type of Vendor
           END OF ty_final.
    DATA:  it_final TYPE TABLE OF ty_final.
    DATA:  wa_final TYPE ty_final.
    TYPES: BEGIN OF ty_final1,
           lifnr TYPE lifnr,
           name1 TYPE name1_gp,
           vname TYPE name1_gp,    "name1 without spl char
           count_name TYPE i,
           name2 TYPE name2_gp,
           ort01 TYPE ort01_gp,   "city
           pstlz TYPE pstlz,      "postal code
           regio TYPE regio,      "region
           sortl TYPE sortl,      "search term
           vsortl TYPE sortl,      "search term without spl char
           count_sortl TYPE i,
           stras TYPE stras_gp,   "street
           adrnr TYPE adrnr,      "address
           erdat TYPE erdat_rf,   "created on
           ernam TYPE ernam_rf,   "created by
           loevm TYPE loevm_x,    "del. flag
           sperr TYPE sperb_x,    "posting block
           sperm TYPE sperm_x,    "Centrally imposed purchasing block
           telf1 TYPE telf1,      "First telephone number
           vtelf1 TYPE telf1,     "tel no. with numbers only
           telf2 TYPE telf2,      "Second telephone number
           telfx TYPE telfx,      "Fax Number
           vtelfx TYPE telfx,     "fax no . without spl char.
           count_fax TYPE i,
           stceg TYPE stceg,         "VAT registration number
           sperq TYPE qsperrfkt,  "Function to block
           j_1iexcd  TYPE j_1iexcd,  "ECC Number
           veccno TYPE j_1iexcd,  "ecc without spl char
           count_ecc TYPE i,
           j_1iexrn  TYPE j_1iexrn,  "Excise Registration Number
           count_ern TYPE i,
           j_1iexrg  TYPE j_1iexrg,  "Excise Range
           j_1iexdi  TYPE j_1iexdi,  "Excise Division
           j_1icstno TYPE j_1icstno, "Central Sales Tax Number
           vcstno TYPE j_1icstno,  "Cst without spl char
           count_cst TYPE i,
           j_1ilstno TYPE j_1ilstno, "Local Sales Tax Number
           vlstno TYPE j_1ilstno, " LST without spl char
           count_lst TYPE i,
           j_1ipanno TYPE j_1ipanno, "Permanent Account Number
           vpanno TYPE j_1ipanno,  "Pan without spl char
           count_pan TYPE i,
           j_1ivtyp  TYPE j_1ivtyp,  "Type of Vendor
           END OF ty_final1.
    DATA:  it_final1 TYPE TABLE OF ty_final1.
    DATA:  wa_final1 TYPE ty_final1.
    *ALV DATA DECLARATION.
    DATA: it_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE slis_fieldcat_alv,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid     LIKE sy-repid.
    DATA: v_name1  TYPE fist-searchw,
          v_name2  TYPE fist-searchw,
          v_sortl1 TYPE fist-searchw,
          v_sortl2 TYPE fist-searchw,
          v_telfx1 TYPE fist-searchw,
          v_telfx2 TYPE fist-searchw,
          v_eccno1 TYPE fist-searchw,
          v_eccno2 TYPE fist-searchw,
          v_cstno1 TYPE fist-searchw,
          v_cstno2 TYPE fist-searchw,
          v_lstno1 TYPE fist-searchw,
          v_lstno2 TYPE fist-searchw,
          v_panno1 TYPE fist-searchw,
          v_panno2 TYPE fist-searchw.
    DATA: telcount TYPE i.
    DATA: v_telf1  TYPE telf1.
    DATA: n TYPE i.
    DATA: telno TYPE telf1.
    *****************Selection Screen***************************
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr.
    SELECT-OPTIONS : s_name1 FOR lfa1-name1.
    SELECT-OPTIONS : s_sortl FOR lfa1-sortl.
    SELECT-OPTIONS : s_ort01 FOR lfa1-ort01.
    SELECT-OPTIONS : s_erdat FOR lfa1-erdat.
    SELECT-OPTIONS : s_ernam FOR lfa1-ernam.
    SELECT-OPTIONS : s_ktokk FOR lfa1-ktokk.
    SELECT-OPTIONS : s_loevm FOR lfa1-loevm.
    SELECT-OPTIONS : s_sperr FOR lfa1-sperr.
    SELECT-OPTIONS : s_sperq FOR lfa1-sperq.
    SELECT-OPTIONS : s_sperm FOR lfa1-sperm.
    SELECT-OPTIONS : s_stceg FOR lfa1-stceg.
    SELECT-OPTIONS : s_eccno  FOR  j_1imovend-j_1iexcd.
    SELECT-OPTIONS : s_ergno  FOR  j_1imovend-j_1iexrn.
    SELECT-OPTIONS : s_exrng  FOR  j_1imovend-j_1iexrg.
    SELECT-OPTIONS : s_exdiv  FOR  j_1imovend-j_1iexdi.
    SELECT-OPTIONS : s_cstno  FOR  j_1imovend-j_1icstno.
    SELECT-OPTIONS : s_lstno  FOR  j_1imovend-j_1ilstno.
    SELECT-OPTIONS : s_panno  FOR  j_1imovend-j_1ipanno .
    SELECT-OPTIONS : s_vntyp  FOR  j_1imovend-j_1ivtyp.
    SELECTION-SCREEN : END OF BLOCK b1.
    ******************START-OF-SELECTION ****************************
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM process_data.
      PERFORM build_layout.
      PERFORM display_data.
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
      SELECT lifnr
             name1
             name2
             ort01
             pstlz
             regio
             sortl
             stras
             adrnr
             erdat
             ernam
             ktokk
             loevm
             sperr
             sperm
             telf1
             telf2
             telfx
             stceg
             sperq
             FROM lfa1
             INTO TABLE it_lfa1
             WHERE lifnr IN  s_lifnr
               AND name1 IN  s_name1
               AND ort01 IN  s_ort01
               AND sortl IN  s_sortl
               AND erdat  IN  s_erdat
               AND ernam IN s_ernam
               AND ktokk IN  s_ktokk
               AND loevm IN  s_loevm
               AND sperr IN s_sperr
               AND sperm IN  s_sperm
               AND stceg IN  s_stceg
               AND sperq  IN  s_sperq.
      IF it_lfa1 IS NOT INITIAL.
        SELECT lifnr
               j_1iexcd
               j_1iexrn
               j_1iexrg
               j_1iexdi
               j_1icstno
               j_1ilstno
               j_1ipanno
               j_1ivtyp
               FROM j_1imovend
               INTO TABLE it_j_1imovend
               FOR ALL ENTRIES IN it_lfa1
               WHERE lifnr = it_lfa1-lifnr
                 AND j_1iexcd  IN s_eccno
                 AND j_1iexrn  IN s_ergno
                 AND j_1iexrg  IN s_exrng
                 AND j_1iexdi  IN s_exdiv
                 AND j_1icstno IN s_cstno
                 AND j_1ilstno IN s_lstno
                 AND j_1ipanno IN s_panno
                 AND j_1ivtyp  IN s_vntyp.
      ENDIF.
    ENDFORM.                    " get_data
    *&      Form  process_data
          text
    -->  p1        text
    <--  p2        text
    FORM process_data .
      SORT it_lfa1 BY lifnr .
    DELETE ADJACENT DUPLICATES FROM it_mara COMPARING matnr matkl.
      LOOP AT it_lfa1 INTO wa_lfa1.
        CLEAR wa_final.
        wa_final-lifnr = wa_lfa1-lifnr.
        wa_final-name1 = wa_lfa1-name1.
        wa_final-name2 = wa_lfa1-name2.
        wa_final-ort01 = wa_lfa1-ort01.
        wa_final-pstlz = wa_lfa1-pstlz.
        wa_final-regio = wa_lfa1-regio.
        wa_final-sortl = wa_lfa1-sortl.
        wa_final-stras = wa_lfa1-stras.
        wa_final-adrnr = wa_lfa1-adrnr.
        wa_final-erdat = wa_lfa1-erdat.
        wa_final-ernam = wa_lfa1-ernam.
        wa_final-loevm = wa_lfa1-loevm.
        wa_final-sperr = wa_lfa1-sperr.
        wa_final-sperm = wa_lfa1-sperm.
        wa_final-telf1 = wa_lfa1-telf1.
        wa_final-telf2 = wa_lfa1-telf2.
        wa_final-telfx = wa_lfa1-telfx.
        wa_final-stceg = wa_lfa1-stceg.
        wa_final-sperq = wa_lfa1-sperq.
    *****Removing spl chars in name1 and translating to uppercase*****
        v_name1 = wa_final-name1.
        IF v_name1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_name1
            IMPORTING
              without_specialchar = v_name2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vname = ''.
          ELSE.
            wa_final-vname = v_name2.
          ENDIF.
        ENDIF.
        TRANSLATE wa_final-vname TO UPPER CASE.
    ******Removing spl char in search term **********************************
        v_sortl1 = wa_final-sortl.
        IF v_sortl1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_sortl1
            IMPORTING
              without_specialchar = v_sortl2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vsortl = ''.
          ELSE.
            wa_final-vsortl = v_sortl2.
          ENDIF.
        ENDIF.
    ******Removing spl char in FAX number *****************************************
        v_telfx1 = wa_final-telfx.
        IF v_telfx1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_telfx1
            IMPORTING
              without_specialchar = v_telfx2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vtelfx = ''.
          ELSE.
            wa_final-vtelfx = v_telfx2.
          ENDIF.
        ENDIF.
        CLEAR wa_j_1imovend.
        READ TABLE it_j_1imovend INTO wa_j_1imovend WITH KEY lifnr = wa_lfa1-lifnr.
        IF sy-subrc = 0.
          wa_final-j_1iexcd  = wa_j_1imovend-j_1iexcd.
          wa_final-j_1iexrn  = wa_j_1imovend-j_1iexrn.
          wa_final-j_1iexrg  = wa_j_1imovend-j_1iexrg.
          wa_final-j_1iexdi  = wa_j_1imovend-j_1iexdi.
          wa_final-j_1icstno = wa_j_1imovend-j_1icstno.
          wa_final-j_1ilstno = wa_j_1imovend-j_1ilstno.
          wa_final-j_1ipanno = wa_j_1imovend-j_1ipanno.
          wa_final-j_1ivtyp  = wa_j_1imovend-j_1ivtyp.
        ENDIF.
    ******Removing spl char in ECC number *****************************************
        v_eccno1 = wa_final-j_1iexcd.
        IF v_eccno1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_eccno1
            IMPORTING
              without_specialchar = v_eccno2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-veccno = ''.
          ELSE.
            wa_final-veccno = v_eccno2.
          ENDIF.
        ENDIF.
    ******Removing spl char in CST number *********************************************
        v_cstno1 = wa_final-j_1icstno.
        IF v_cstno1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_cstno1
            IMPORTING
              without_specialchar = v_cstno2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vcstno = ''.
          ELSE.
            wa_final-vcstno = v_cstno2.
          ENDIF.
        ENDIF.
    ******Removing spl char in LST number *********************************************
        v_lstno1 = wa_final-j_1ilstno.
        IF v_lstno1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_lstno1
            IMPORTING
              without_specialchar = v_lstno2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vlstno = ''.
          ELSE.
            wa_final-vlstno = v_lstno2.
          ENDIF.
        ENDIF.
    ******Removing spl char in PAN number *********************************************
        v_panno1 = wa_final-j_1ipanno.
        IF v_panno1 IS NOT INITIAL.
          CALL FUNCTION 'SF_SPECIALCHAR_DELETE'
            EXPORTING
              with_specialchar    = v_panno1
            IMPORTING
              without_specialchar = v_panno2
            EXCEPTIONS
              result_word_empty   = 1
              OTHERS              = 2.
          IF sy-subrc <> 0.
            wa_final-vpanno = ''.
          ELSE.
            wa_final-vpanno = v_panno2.
          ENDIF.
        ENDIF.
    *********Removing spl chars and alphabets from tel.no.***************************
        n = 0.
        telcount = STRLEN( wa_final-telf1 ).
        DO telcount TIMES.
          MOVE wa_final-telf1+n(1) TO v_telf1.
          IF v_telf1 CA '0123456789'.
            MOVE v_telf1 TO wa_final-vtelf1+n(1).
          ENDIF.
          n = n + 1.
          IF n = telcount .
            EXIT.
          ENDIF.
        ENDDO.
        CONDENSE wa_final-vtelf1 NO-GAPS.
      APPEND wa_final TO it_final.
      ENDLOOP.
    *****************Counting Duplicate Entries**************************************
      SORT it_final BY vname.
      it_final1 = it_final.
      LOOP AT it_final INTO wa_final.
    CLEAR wa_final1.
        AT END OF vname.
          LOOP AT it_final1 INTO wa_final1 WHERE vname = wa_final-vname.
            wa_final1-count_name = wa_final1-count_name + 1.
          ENDLOOP.
          IF wa_final1-count_name GT 1.
           wa_final-count_name = wa_final1-count_name.
            MODIFY it_final FROM wa_final1  TRANSPORTING count_name.
          ENDIF.
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " process_data

  • Displaying array from another method

    Hello for this code I want to display the array from the first method in the second method although when I run it, it displays 6 times the whole array - well the the last iteration shows the whole array. I have only just started using different methods.
    Please could someone say why this is happening.
    Cheers
    John
    import java.util.*;
    public class Lottery
         public static void main(String[] argStrings)
              int[] lotteryArray = new int[6];
              for(int count = 0; count < 6; count++)
                   double randomNumber = Math.random();
                   double biggerRandom = (randomNumber * 50);
                   int integerNumber = (int)biggerRandom;
                   lotteryArray[count] = integerNumber;
                   displayNumbers(lotteryArray);
         public static void displayNumbers(int[] lotteryArray)
              System.out.println("Lottery numbers are:");
              for(int i = 0; i < lotteryArray.length; i++)
                   System.out.print(lotteryArray[i] + " ");
              System.out.println();
    }

    Well I know your right but actualy getting this to work for my program is proving hard. This is my progress so far:
    Cheers
    John
    public static void main(String[] argStrings)
              int[] lotteryArray = new int[6];
              int p = 0;
              boolean duplicate = false;
              while(p < 6)
                   for(int count = 0; count < lotteryArray.length; count++)
                        double randomNumber = Math.random();
                        double biggerRandom = (randomNumber * 50);
                        int integerNumber = (int)biggerRandom;
                        if (lotteryArray == lotteryArray[count])
                             duplicate = true;
                        if (duplicate == false) //not a duplicate
                             lotteryArray[++count] = integerNumber;
                   displayNumbers(lotteryArray);
         }

  • DeDup merged Libraries

    I'm looking for workflow advice or tips to use iPhoto as the application of choice to manage my photos (20,000+ counting duplicates). I've read though or listened to tutorials on iPhoto and have a fair working knowledge of computers and shared applications.
    I switched over to apple a couple of years ago. This switch left windows folders of photos on my work computers, home computers, laptops and phones. There are more than one because as our kids grew up and left home they left many photos on our file servers scattered all over.  At work and home, many times our kids would just hand me a thumb drive/cd with photos which I promptly dumped into a folder and imported into iPhoto later on the nearest computer.
    Now, I'd like to reclaim wasted space by deleting these scattered folders once I know they have been imported to iPhoto.
    I'm using Drop Box as the place for the "default merged library" so I can access the same library or libraries from multiple locations.  I will be the only person to use the Drop Box so I'm not concerned about multiple users of the same database.
    I've used "Library Manager" to merge libraries from different computers and preserve the meta data, tags, edited versions, etc.
    One main issue, is the vast number of duplicates I'm discovering and how to trim these from the main library.  I have started using additional libraries to help break apart the huge single mass into smaller more manageable bites but this just helped uncover more duplicates.
    Are there any shortcuts to help discover and remove duplicates?  Automated tools or scripts?  Can I safely remove all the old folders once I see the photo in iPhoto?  If I import the same folder twice from two different computers it does not always obey the "do not import duplicates" check box as the clocks may not have been the same when the photos were loaded on the computer originally. Any ideas about how to compensate for these duplicates and save time is appreciated. Recommendations about sensible ways to use multiple libraries would help too.
    End goal is to have a single set of iPhoto libraries, without duplicates, stored on Drop Box from which I can export albums/events to family and friends via a web link. I would only like the photo image stored and taking up space without the worry about files, file folders and sub structures.
    Thanks,
    pblpup

    Couple of comments:
    I'm using Drop Box as the place for the "default merged library" so I can access the same library or libraries from multiple locations.  I will be the only person to use the Drop Box so I'm not concerned about multiple users of the same database.
    We ran some experiments here a while back to see if we could sync Libraries back and forth with Drop Box and they were corrupted in the process.
    iPhoto needs to have the Library sitting on disk formatted Mac OS Extended (Journaled). While the DropBox folder on your machine is on a Disk with the correct format, the one on the DropBox server isn't.  And to get to the other machine the Library spends time there.
    Are you running a Managed or a Referenced Library?
    A Managed Library, is the default setting, and iPhoto copies files into the iPhoto Library when Importing. The files are then stored in the Library package
    A Referenced Library is when iPhoto is NOT copying the files into the iPhoto Library when importing because you made a change at iPhoto -> Preferences -> Advanced. (You unchecked the option to copy files into the Library on import) The files are then stored where ever you put them and not in the Library package. In this scenario you are responsible for the File Management.
    If you're running a Managed Library then yes, you can delete the files from the Finder after importing.
    For dealing with duplicates in iPhoto check out Duplicate Annihilator
    Regards
    TD

  • Help build a query !!!

    There are two tables. One consists of members with expenses and next with fixed percentile. I need to build a single query based upon following
    1. Need to know the number of members that fall under a fixed range of percent like 10%, 40%, 50%. Suppose, total no of members = 50 then
    10% -> 5
    40% -> 20
    50% -> 25
    2. Now I need to rank the members as per their expenses. So, if following be the expenses of the members sorted by expenses
    A1 100
    A2 99
    A3 98
    A4 97
    A5 96
    A6 95
    A50 50
    then
    total expense should be found out as
    10% [sum of top 5 : From A1 to A5] = 100 + 99 + 98 + 97 + 96 = 490
    40% [sum of next 20: From A6 to A26]
    50% [sum of next 25: From A27 to A50]
    Please help !!!!!
    Edited by: josleen on Jan 11, 2010 7:50 AM

    Hi,
    There are a number of analytic functions for dealing with percentiles.
    Depending on how you want to handle ties, how you count duplicate values, and other factors, PERCENT_RANK might be best for this problem.
    You really should post the information Centinul requested whenever you have a question.
    If you can phrase your question in terms of commonly available tables, then you don't have to post them.
    For example, to group employees from the scott.emp table according to their salaries, and get a total of salaries by group, you could create a groups table and join it to the emp table, like this:
    CREATE TABLE     groups
    (      seq_id     NUMBER
    ,      label     VARCHAR2 (20)
    ,      low_pct     NUMBER      -- lowest number IN this group
    ,      high_pct     NUMBER      -- lowest number NOT IN this group, but in the next highest group
    INSERT INTO groups (seq_id, label, low_pct, high_pct) VALUES (1, 'Top 10%',     0,     10);
    INSERT INTO groups (seq_id, label, low_pct, high_pct) VALUES (2, '10%-50%',     10,     50);
    INSERT INTO groups (seq_id, label, low_pct, high_pct) VALUES (3, 'Bottom 50%',     50,     101);
    COMMIT;
    WITH     got_pct          AS
         SELECT ename
         ,      sal
         ,      100 * PERCENT_RANK () OVER ( ORDER BY sal DESC
                                                  ,          empno
                               )     AS pct
         FROM   scott.emp
    SELECT    g.label
    ,       SUM (p.sal)     AS group_total
    FROM       got_pct     p
    JOIN       groups     g     ON     p.pct     >= g.low_pct
                          AND     p.pct     <  g.high_pct
    GROUP BY  g.label
    ORDER BY  MIN (g.seq_id)
    ;Output:
    LABEL                GROUP_TOTAL
    Top 10%                     8000
    10%-50%                    12875
    Bottom 50%                  8150If you need help understanding a query with sub-queries, it helps to run the sub-query by iteself.
    In this case:
    WITH     got_pct          AS
         SELECT ename
         ,      sal
         ,      100 * PERCENT_RANK () OVER ( ORDER BY sal DESC
                                                  ,          empno
                               )     AS pct
         FROM   scott.emp
    SELECT     *
    FROM     got_pct
    ;produces this output:
    ENAME             SAL        PCT
    KING             5000          0
    SCOTT            3000 7.69230769
    FORD             3000 15.3846154
    JONES            2975 23.0769231
    BLAKE            2850 30.7692308
    CLARK            2450 38.4615385
    ALLEN            1600 46.1538462
    TURNER           1500 53.8461538
    MILLER           1300 61.5384615
    WARD             1250 69.2307692
    MARTIN           1250 76.9230769
    ADAMS            1100 84.6153846
    JAMES             950 92.3076923
    SMITH             800        100In case of a tie, PERCENT_RANK assigns the same result to all rows with the same input value. The reason I included empno in the analytic ORDER BY clause was to prevent ties. Otherwise, both SCOTT and FORD (with the exact same sal=3000) would be assigned pct=7.69230769, and the "Top 10%" would then include 3 out of 14 rows (over 21% of the rows), which, outside of Lake Woebegone, shouldn't happen.
    Edited by: Frank Kulash on Jan 11, 2010 11:02 AM
    Explanation added.

  • Searched-- not found

    I went through the search for open discussions, did not find any answers for this one. Yesterday I was playing newly loaded songs in iTunes and it crashed. I followed the instructions to report it, then iTunes "restarted" by itself.
    Previously I had a problem with repeated iTunes crashes, when the updates in November of last year came out it quit crashing-- thankfully. Then, as I said, yesterday it crashed.
    It did NOT reload my library. All of the smart playlists are blank, and if you go to the music folder it shows 1236 songs.
    Before the crash it had 44,333 songs.
    Not only that, but if you start to play the songs listed more than a few are incomplete, just cut off in the middle.
    Reloading, reset of play counts, duplicate issues-- it takes MONTHS to fix anything like this, and even if you do, then you have to live in fear of it doing it again. The latest "damaged library" is 12.1 mb while the new one is a whopping 2.1 mb-- so the data should be in the damaged library.
    Is there any [bleep] way to get the load dates, last played date, play counts out-- to "undamage" the library?
    The one time I actually got a response from Apple I was told to call a tech and give him a case number-- when I did so he told me he needed a credit card, that it still was a charged help, and a minimum of about sixty dollars. I declined that "offer" and thankfully the iTunes update helped.
    Now here I am.
    Six hours before the crash I went to the Apple online store and sprang for almost fourteen hundred dollars of new machine to replace this old one, but since the machine is due to arrive in a week I want to get this taken care of BEFORE the new toy arrives with a new OS to learn.
    Any suggestions this time?
    Or does iTunes have a "stress the user" function I don't know about?
    .

    I've been through the disc error checking route a couple of times-- the drives are fine, the original data was fine, it appears to be damaged during playback.
    I have NOT accessed the backup copy because that would be several hundred songs short of what I have. It is in reserve; my paranoid "copy it all and then turn off the drive" system simply means that if this cannot be salvaged I will only have lost a couple of hundred songs.
    I know there were a number of unplayed songs when it crashed because that is what I was doing-- listening to new music. I just don't know what the names of the two or three dozen songs I had yet to hear, and I really want last play dates and play counts.
    I know that sometimes I will "show" duplicates but when you go to the actual files there is only one copy, but I also deliberately keep some dupes-- like the original Harry Champion "I'm Henery The Eighth" recording.
    I just don't have a clue was to why it crashed.
    .

  • Getting duplicates in Case  and Count clause in Report Generation

    Hi all,
    let me explain the Base first (just the Section which is in the scope of this code )then ill go to code and my problem.i have a Set of Pre-defined Tasks in *"TASK"* Table.i have a system which will provision the User Request by allotting the Particular Task to their Request.Each Request will mapped to the Instance of the (Pre-defined)Task, this will be maintained in a separate table *"TASK_INSTANCE"* against the user request id. Each task has a pre-defined duration.and their date of completion date will be stored in column of data type Time Stamp.
    My scenario is i need to generate report based on the completion date.report requirement is , i need to give the count of tasks which having completion date as today,tomorrow and next day they grouped based on Task Names.
    my problem is, im getting duplicates though i used the Distinct.There is no possible of duplicates by means of join, since im using group by task name.each Record in the Task_instance table has direct relation to the Task ID. For eg : im getting one row with the count satisfying the Condition and next row with empty set.i cant figure it out why happening.need your help in figuring out this.
    Let me append the query below,
    SELECT   task.task_name,
    *(CASE*
    WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
    -1)
    THEN
    *(COUNT (task_instance.ptd_pdd_date))*
    END)
    AS "1_day_behind",
    *(CASE*
    WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
    -2)
    THEN
    COUNT (task_instance.ptd_pdd_date)
    END)
    AS "2_day_behind",
    *(CASE*
    WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
    -3)
    THEN
    COUNT (task_instance.ptd_pdd_date)
    END)
    AS "3_day_behind"
    FROM   task, task_instance
    WHERE       task.task_id = task_instance.task_id
    AND task_instance.status_id = 1
    AND task_instance.ptd_pdd_date IS NOT NULL
    GROUP BY   (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)),
    task.task_name;
    task_instance.status_id = 1 it refers to the task which are in "IN PROGRESS" state.
    This is the (Sample) result set i am getting.In this, the task UI_Contact_Customer is repeated three times. with different count in separate rows and null in separate row .i need to avoid those duplicates.please advise.
    TASK_NAME     | "1_DAY_BEHIND"     | "2_DAY_BEHIND"     | "3_DAY_BEHIND" |
    ______________________________|________________|_________________|_________________|               
    UI_Conduct_Fiber_Plant_Survey_____|________________|________________ |_________________|
    UI_Conduct_Site_Survey__________ |_______________ |________________ |_________________|
    UI_ConductFiberSurvey_C___________|________________|________________ |________________|
    UI_ConductSiteSurvey_C __________|________________|_________________|_________________|
    UI_Contact_Customer_____________|________________|_________________|_________________|
    UI_Contact_Customer ____________ |_______10_______|________________ |_________________|
    UI_Contact_Customer_____________|________________|_______ 12_______|_________________|
    UI_Create_Account_Equip_C_______ |________________|_________________|_________________|
    UI_Create_Account_Equipment_____ |________________|_________________|_________________|
    UI_Create_CM_Ticket           |     | | |
    ______________________________|________________|_________________|_________________|
    In the Above result set, especially UI_Contact_Customer task,ten of their instance having completion date tomorrow and 12 instance having next day as completion date. i need get all those as single row without any duplicates.
    Thanks,
    Jeevanand.K

    hey super dude,
    it really works fine.matching my requirement exactly.
    My hearty appreciation to you friend, and a small appreciation for me tooo,because i formed the base query. :-)
    i used the below query,it requirement gets completed.
    A big Thanks for your super fast Response
    SELECT   task.task_name,
    COUNT(CASE
    WHEN TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date) BETWEEN 1
    AND  14
    THEN
    *1*
    END)
    AS "TWO weeks older",
    COUNT(CASE
    WHEN TRUNC (SYSDATE) - TRUNC(task_instance.ptd_pdd_date) =
    -1
    THEN
    *1*
    END)
    AS "1_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) = -2)
    THEN
    *1*
    END)
    AS "2_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) = -3)
    THEN
    *1*
    END)
    AS "3_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) = -4)
    THEN
    *1*
    END)
    AS "4_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) = -5)
    THEN
    *1*
    END)
    AS "5_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) = -6)
    THEN
    *1*
    END)
    AS "6_day_left",
    COUNT(CASE
    WHEN ( (TRUNC (SYSDATE)
    - TRUNC (task_instance.ptd_pdd_date)) >= -7)
    THEN
    *1*
    END)
    AS "After one week"
    FROM   task, task_instance
    WHERE   task.task_id = task_instance.task_id AND task_instance.status_id = 1
    GROUP BY   task.task_name;
    Thanks,
    Jeevanand.K

Maybe you are looking for

  • ASA IPSEC VPN Design Question; ARP Between ASA

    I"ve a requirement to put two ASA between two sites. The second site has hosts within the same network as the first site (conflict of fundamental routing principles). Can you put an ASA inline between the router and distribution switch at each site,

  • Logging through sockets

    Hi I'm trying to send logging information through sockets using log4j. My configuration file is : log4j.rootLogger=Debug, Socket log4j.appender.Socket=org.apache.log4j.net.SocketAppender log4j.appender.Socket.Port=12345 log4j.appender.Socket.RemoteHo

  • GetSubwebsForCurrentUser does not check Root site

    Hi, I am trying to check if logged-in user has permissions to site. I have used the "getSubwebsForCurrentUser", but it does not check the Parent site and only checks for subsites. What am I missing? My current code is as below: function sharePointRea

  • ITunes insists on importing WMA files alphabetically - not good

    I am dragging music from My Music file into iTunes, which is quick and easy, but iTunes is putting them in alphabetical order instead of the order they are on the CD/album. Do I have a choice in the order? Please help - this is not life threatening,

  • How to close apps on  IOS 7?

    Any advice?