#MULTIVALUE even affter checking avoid duplicate row agg.

Hi experts
I am getting multivalue error in few rows even after checking the option of avoid duplicate row  agg.
any ideas
regards

Hi,
#Multivalue :- this error will occur in 3ways
1) #multivalue in aggregation -
  the o/p context not include i/p context its  situation this error occurs.
2) #multivalue in breaks header or footer
3) #multivalue in section level.
Please provide us with the description of the issue u r facing.
Regards,
Chitha.

Similar Messages

  • Lookup transformation to avoid duplicate rows? - SSIS 2005

    Hi,
    I'm maintaning a SSIS 2005 pkg. I need to read a flat file to write on a SQL Server table, avoiding duplicates.
    I can have duplicates rows into the flat file to import and I need to prevent the insert of any rows already existing in the SQL Server table.
    So, I think to use a lookup transformation. I've created a flat file source, then I connect it to a lookup transformation and inside it I've specified as the reference table the SQL Server destination table. Then, I've checked the available lookup columns
    each adding as a new column: but the lookup task has arised an error and so I've specified as lookup operation the replacement. For each unmatching I need to write on the SQL Server table (the reference table in the lookup). For the lookup output error I've
    indicate to ignore failure. Other steps?
    However, when I run the pkg then inside the SQL Server destination table I can see only NULL values, but I want to see the rows don't already present in the table.
    Any suggests to me, please? Thanks

    Hi,
    I'm using SSIS 2005 as reported in the title of the post.
    I could have duplicates inside the source file and the existing table could haven't any rows.
    Thanks
    If you dont have any rows in existing table, then they will go through Error output in lookup task. For duplicates, lookup task will find matches and will go through lookup match output
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • To avoid duplicate rows in oracle 8i

    Can you suggest how to prevent duplicate rows while in situations where multiple refreshes from a single export file using Oracle 8.1.7?
    Do i need to specify Commit=Y, Constraints= N and IGNORE=N while importing data?
    Your suggestion would be appreciated.
    Thanks in advance.

    PK or not pk, if you set ignore=n, the import will be abort in case of table already exists, so you won't have any duplicate rows.
    SQL> create table mytable as select * from all_users union all select * from all_users;
    Table created.
    SQL> select count(*) from mytable;
      COUNT(*)
            14
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:40 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export done in UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                        MYTABLE         14 rows exported
    Export terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                     
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:32:48 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> drop table mytable;
    Table dropped.
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:07 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"         14 rows imported
    Import terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:33:46 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLE "MYTABLE" ("USERNAME" VARCHAR2(30), "USER_ID" NUMBER, "CREATED"
    "" DATE)  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6553"
    "6 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 505 PCTINCREASE 0 FREELISTS 1 FREELI"
    "ST GROUPS 1 BUFFER_POOL DEFAULT)                        LOGGING NOCOMPRESS"
    Import terminated successfully with warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                     
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:34:13 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> select count(*) from mytable;
      COUNT(*)
            14
    SQL>Now, if you haven't pk and set ignore=y, you will have duplicate lines, for sure :
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:33 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"         14 rows imported
    Import terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> sqlplus P97RPPRD/P97RPPRD                                              
    SQL*Plus: Release 9.2.0.4.0 - Production on Tue Nov 14 13:37:57 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    SQL> select count(*) from mytable;
      COUNT(*)
            28
    SQL> Now, test with pk and ignore=y, import doesn't insert the duplicate key, so you won't have any duplicate rows :
    SQL> drop table mytable;
    Table dropped.
    SQL> create table mytable as select * from all_users;
    Table created.
    SQL> alter table mytable add (primary key (username));
    Table altered.
    SQL> insert into mytable select * from all_users;
    insert into mytable select * from all_users
    ERROR at line 1:
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    SQL> quit
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> exp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp        
    Export: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:39 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export done in UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                        MYTABLE          7 rows exported
    Export terminated successfully without warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> imp P97RPPRD/P97RPPRD tables=mytable log=test.log file=test.dmp ignore=y
    Import: Release 9.2.0.4.0 - Production on Tue Nov 14 13:41:49 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.4.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    import done in UTF8 character set and AL16UTF16 NCHAR character set
    . importing P97RPPRD's objects into P97RPPRD
    . . importing table                      "MYTABLE"
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 SYS
    Column 2 0
    Column 3 14-NOV-2005:16:14:52
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 SYSTEM
    Column 2 5
    Column 3 14-NOV-2005:16:14:52
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 OUTLN
    Column 2 11
    Column 3 14-NOV-2005:16:15:05
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 DBSNMP
    Column 2 19
    Column 3 14-NOV-2005:16:24:23
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 PS
    Column 2 21
    Column 3 14-NOV-2005:16:36:41
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 P97RPPRD
    Column 2 24
    Column 3 14-NOV-2005:16:53:41
    IMP-00019: row rejected due to ORACLE error 1
    IMP-00003: ORACLE error 1 encountered
    ORA-00001: unique constraint (P97RPPRD.SYS_C001422815) violated
    Column 1 PEOPLE
    Column 2 25
    Column 3 14-NOV-2005:16:57:09          0 rows imported
    Import terminated successfully with warnings.
    [data/ora/adm/DBA_ORACLE i05c09 : oracle : P97RPPRD ]> HTH,
    Nicolas.

  • SQL Plus: Check for duplicate rows

    Hi.
    Let say I have a table called HISTORY.
    I have 3 fields in this table(EQ_NO, HISTORY_TYPE, REC_TIME_IN)
    Sample data:
    ABC123,REC,12:05
    ABC123,STA,12:05
    ABC123,DIS,12:00
    XYZ123,REC,12:05
    XYZ123,STA,12:05
    XYZ123,DIS,11:00
    Question:
    How to select the data where its REC_TIME_IN is/are not equal to same EQ_NO and HISTORY_TYPE = 'REC') ??
    Thanks.

    If I understood well, if the data be like this :
    ABC123,REC,12:05
    ABC123,REC,13:05
    ABC123,STA,12:05
    ABC123,STA,12:05
    ABC123,DIS,12:00
    XYZ123,REC,10:05
    XYZ123,REC,12:05
    XYZ123,STA,12:05
    XYZ123,DIS,11:00
    The query result should be :
    ABC123,REC,12:05
    ABC123,REC,13:05
    XYZ123,REC,10:05
    XYZ123,REC,12:05
    If so :
    create table test(
    EQ_NO varchar2(10),
    HISTORY_TYPE char(3),
    REC_TIME_IN varchar(10))
    insert into test values('ABC123','REC','12:05' );
    insert into test values('ABC123','REC','13:05' );
    insert into test values('ABC123','STA','12:05' );
    insert into test values('ABC123','STA','12:05' );
    insert into test values('ABC123','DST','12:00' );
    insert into test values('XYZ123','REC','10:05' );
    insert into test values('XYZ123','REC','12:05' );
    insert into test values('XYZ123','STA','12:05' );
    insert into test values('XYZ123','DIS','11:05' );
    select a.*
    from test a
    where eq_no||history_type
    in (select eq_no||history_type
    from test b
    where a.rec_time_in = b.rec_time_in )
    AND history_type = 'REC'

  • Duplicate rows in Webi Report

    Anyone can pls tell me how to avoid duplicate rows in a webi report. I have tried checking the 'Avoid duplicate row agg.' option as well as 'Retrieve duplicate rows'.
    The query that is generated in the webi gives proper results wehn run at the database level but not in the report.
    What can be the problem?

    Hi VickyBobj,
    It's hard to know, but my guess is the way the objects are defined in the universe. Make sure your measures are defined correctly, as sum, count, etc. and also make sure you have placed dimensions and measures correctiy within the report format - meaning generally dimensions in the headers and measures in the body.
    Thanks

  • Crystal report duplicate row problem

    Hi expert,
    Need help about crystal report for my customer, want to make report about outgoing payment(OVPM) but it become duplicate row for detail because 1 payment include lot cheque(VPM1) more than 1,i just want to know if there got other method to avoid duplicate row.I also try put formula for detail area "{VPM1.CheckAct} = Next({VPM1.CheckAct})" or "{VPM1.CheckAct} = previous({VPM1.CheckAct})"..it useful for 1 row only,if i put more row,it will eliminate other row,just show 1 row.
    Here is my query take from crystal report.
    SELECT 
    "OVPM"."DocTotal", "OVPM"."DocNum", "OVPM"."DocDate",
    "NNM1"."SeriesName", "OVPM"."Address", "OVPM"."DocCurr", "VPM1"."CheckNum",
    "VPM4"."AcctCode", "OVPM"."CheckAcct", "OACT_1"."AcctName", "OACT_2"."AcctName",
      "VPM4"."Descrip", "OVPM"."Comments", "OVPM"."NoDocSum", "OVPM"."DocType", "VPM2"."DocEntry",
       "VPM2"."SumApplied", "OPCH"."DocDate", "VPM2"."InvType", "OCRD"."Phone1", "OCRD"."Fax",
        "OCRD"."CntctPrsn", "VPM2"."DocNum", "VPM1"."BankCode", "OVPM"."CardName", "OVPM"."CardCode",
         "VPM1"."CheckAct", "OACT_3"."AcctName", "VPM1"."CheckSum", "VPM1"."LineID", "VPM4"."OcrCode",
          "OVPM"."CounterRef", "OVPM"."TrsfrAcct", "OACT_4"."AcctName", "OVPM"."TrsfrSum",
           "OVPM"."PayToCode", "OVPM"."JrnlMemo", "VPM4"."SumApplied", "OVPM"."CashAcct", "VPM1"."U_Ref"
    FROM  
    "OVPM" "OVPM"
    LEFT OUTER JOIN "VPM2" "VPM2" ON "OVPM"."DocNum"="VPM2"."DocNum"
    LEFT OUTER JOIN "NNM1" "NNM1" ON "OVPM"."Series"="NNM1"."Series"
    LEFT outer JOIN "VPM1" "VPM1" ON "OVPM"."Docentry"="VPM1"."DocNum"
    LEFT OUTER JOIN "VPM4" "VPM4" ON "OVPM"."DocNum"="VPM4"."DocNum"
    LEFT OUTER JOIN "OACT" "OACT_2" ON "OVPM"."CheckAcct"="OACT_2"."AcctCode"
    LEFT OUTER JOIN "OCRD" "OCRD" ON "OVPM"."CardCode"="OCRD"."CardCode"
    LEFT OUTER JOIN "OACT" "OACT_4" ON "OVPM"."TrsfrAcct"="OACT_4"."AcctCode"
    LEFT OUTER JOIN "OACT" "OACT_3" ON "VPM1"."CheckAct"="OACT_3"."AcctCode"
    LEFT OUTER JOIN "OACT" "OACT_1" ON "VPM4"."AcctCode"="OACT_1"."AcctCode"
    LEFT OUTER JOIN "OPCH" "OPCH" ON "VPM2"."DocEntry"="OPCH"."DocEntry"
    WHERE  "OVPM"."DocNum"=9005070
    ORDER BY "OVPM"."DocNum", "VPM1"."LineID"

    Hi,
    Change LEFT outer JOIN "VPM1" "VPM1" ON "OVPM"."Docentry"="VPM1"."DocNum"
    to: LEFT JOIN "VPM1" "VPM1" ON "OVPM"."DoceNum"="VPM1"."DocNum"
    Remove: LEFT OUTER JOIN "OACT" "OACT_3" ON "VPM1"."CheckAct"="OACT_3"."AcctCode"
    Thanks,
    Gordon

  • Duplicate rows in 5 table

    I have five tables(A,B,C,D,E), and I am trying to check for duplicate rows in all the tables, I tried using inner join, but the first three join did not return any table. is there another way.the tables only have two columns , the email(different values)
    and authour (which is the same person in the table)
    when i tried 
    select * from TABLE A
    INNER JOIN TABLE B
    ON TABLEA. EMAIL = TABLEB.EMAIL
    INNER JOIN TABLEC
    ON TABLEA.EMAIL=TABLEC.EMAIL
    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by ,but this will only show me the duplicates and not the authours
    please any other way

    it came back with no result, the other way I am thinking is to unioun all all the tables and try to use count and group by (but I could not insert my result in a new table)
    please any other way
    I dont understand your point here...Are you trying the below?
    Create Table T1(name varchar(50),Email Varchar(50))
    Insert into T1 Values('SQL','[email protected]'),('.NET','[email protected]')
    Create Table T2(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Server','[email protected]'),('BizTalk','[email protected]')
    Create Table T3(name varchar(50),Email Varchar(50))
    Insert into T2 Values('Sql','[email protected]'),('server','[email protected]')
    ;With cte as
    (Select * From T1
    Union All
    Select * From T2
    Union All
    Select * From T3)
    Select name,email, count(1) From cte Group by name , email having count(1)>1
    Drop table T1,T2,T3
    I was able to insert the union product in a table, and i used this 
    SELECT EMAIL,AUTHOR,COUNT(EMAIL) AS AMOUNT FROM ALLEMAIL
     GROUP BY AUTHOR,EMAIL
     ORDER BY  AMOUNT DESC, email desc
    but its showing the email and the count but its appearing like the duplicate is only associated with one authour

  • Hide duplicate row and analytic functions

    Hi all,
    I have to count how many customers have two particular product on the same area.
    Table cols are:
    AREA
    PRODUCT_CODE (PK)
    CUSTOMER_ID (PK)
    QTA
    The query is:
    select distinct area, count(customer_id) over(PARTITION BY area)
    from all_products
    where product_code in ('BC01007', 'BC01004')
    group by area, customer_id
    having ( sum(decode(FPP.PRODOTTO_CODE,'BC01007',qta,0)) ) > 0)
    and ( sum(decode(FPP.PRODOTTO_CODE,'BC01004',qta,0)) ) > 0);
    In SQL*PLUS works fine, but in Oracle Discoverer I can't get distinct results also if I chek "Hide duplicate rows" in Table Layout .
    Anybody have another way to get distinct results for analytic function results?
    Thanks in advance,
    Giuseppe

    The query in Disco is exactly that I've post before.
    Results are there:
    AREA.........................................C1
    01704 - AREA VR NORD..............3
    01704 - AREA VR NORD..............3
    01704 - AREA VR NORD..............3
    01705 - AREA VR SUD.................1
    02702 - AREA EMILIA NORD........1
    If I check "hide duplicate row" in layout option results didn't change.
    If I add distinct clause manually in SQL*PLUS the query become:
    SELECT distinct o141151.AREA as E141152,COUNT(o141151.CUSTOMER_ID) OVER(PARTITION BY o141151.AREA ) as C_1
    FROM BPN.ALL_PRODUCTS o141151
    WHERE (o141151.PRODUCT_CODE IN ('BC01006','BC01007','BC01004'))
    GROUP BY o141151.AREA,o141151.CUSTOMER_ID
    HAVING (( SUM(DECODE(o141151.PRODUCT_CODE,'BC01006',1,0)) ) > 0 AND ( SUM(DECODE(o141151.PRODUCT_CODE,'BC01004',1,0)) ) > 0)
    and the results are not duplicate.
    AREA.........................................C1
    01704 - AREA VR NORD..............3
    01705 - AREA VR SUD.................1
    02702 - AREA EMILIA NORD........1
    There is any other way to force distinct clause in Discoverer?
    Thank you
    Giuseppe

  • Avoid duplicates in datagrid

    There are 2 dataGrids: G1 and G2. Rows can be dragged and
    dropped from G1 into G2. There can be duplicate rows in G1, but we
    need to avoid duplicate rows in G2.
    Ideally there should be a STOP sign displayed when there is
    an attempt to drop a duplicate row into G2.
    How can this be done?
    Thanks.

    in your drag drop handler, get the dragged row(s), use the
    getItemIndex() method of the underlying dataProvider array
    collection to see if this row is already there, if so, just call
    the event.preventDefault() and set the feedback to stop.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid =1318924&highlight_key=y&keyword1=preventdefault
    ATTA

  • Setfilter to display all the duplicate rows pb7

    Friends,
    my version is powerbuilder 7.
    i am checking the duplicate rows in the datawindow before inserting.
    in a button click event...i have the below code
    dw_master.SetSort ("rollno A")
    dw_master.Sort()
    dw_master.SetFilter("rollno = rollno[-1]")
    dw_master.Filter()
    if dw_master.RowCount() > 0 then
        MessageBox('Duplicate Rows','Check the Duplicate Roll numbers',StopSign!,OK!)
        Return 1
    end if
    //no dups, so clear the filter and do the update...
    dw_master.SetFilter ("")
    dw_master.Filter()
    i have 2 duplicate rows...but this setfilter is displaying only one row....
    if it displays all the duplicate rows then it will be very useful for me...
    how can i modify this code to get all the duplicate rows in this datawindow before inserting?
    thanks

    Instead of a filter you could do this...
    boolean lb_dupe_found=false
    long ll_row, ll_rowcount
    string ls_val1, ls_val2
    ll_rowcount = dw_1.rowcount()
    for ll_row = 2 to ll_rowcount
    ls_val1 = dw_1.getitemstring(ll_row, 'col1')
    ls_val2 = dw_1.getitemstring(ll_row -1, 'col1')
    if ls_val1 = ls_val2 then
      // duplicate
      lb_dupe_found = true
      exit
    end if
    next
    if lb_dupe_found then
    messagebox('DUPE', 'Houston we have a problem!')
    else
    messagebox('SAVE', 'Data valid for saving')
    end if

  • To avoid duplicate entries in multi row

    Hi i need to avoid duplicate entries in multi record form.In the master block i have AGENCY CODE.These are the fields, RATING_CODE(composite primary key alng with AGENCY_CODE in the detail block,but set as hidden) and DESCRIPTION
    in the detail block.If AGENCY_CODE is CRISIL,then for that i should not enter duplicate RATING CODES.I have written
    DECLARE
         L_COUNT2 NUMBER;
         l_ret varchar2(20);
    BEGIN
         SELECT COUNT(*) INTO L_COUNT2 FROM CSTM_AGENCY_CODE_DETAIL
    WHERE AGENCY_CODE=:BLK_CSTM_AGENCY_CODE_DETAIL.AGENCY_CODE
    AND RATING_CODE=:BLK_CSTM_AGENCY_CODE_DETAIL.RATING_CODE;
    IF L_COUNT2 > 0 THEN
              l_ret := ovpkcs.fn_dispmsg('AGYCOD-03;',';',';');
    Raise Form_Trigger_Failure;
    END IF;
    END;
    in WHEN_VALIDATE_ITEM.
    Now when i press the TAB to move next time it gives the message,DUPLICATE RATING CODE.The
    problem is when i move back to the previous record by clicking mouse and change it to the already existing value,and while i save the validation is not happening and the message is not shown.Kindly tell me where i should code.
    Thank you

    hy,
    you can check whan commit( an save button)
    for i = 1 to n-1
    check condition (item = item +1)
    next_record
    end
    or by stored insert whit exception return to form program when duplicate key is found
    ...

  • Checking for duplicate primary keys on row inserts

    Checking for duplicate primary keys on row inserts
    I have a situation where I will be making bulk table inserts knowing that the primary key value will in some cases already exist. In this is the case I simply want to ignore the duplicate inserts.
    Should I be performing a sub-query on the table and using a statement like:
    where not exist in
    Or is there a cleaner way of discarding or checking for duplicates on insert.
    My concerns were mainly one of performance, as my routine will be inserting a few thousand rows in its operation.

    The MERGE commnad is a good option when a large percentage of the data will exist in the target because it is much more efficient to attempt to update then insert when the update affects zero rows than capture an error and convert it to an update.
    However, since in this case it would appear that only a few rows will alreadys exist and we want to ignore the duplicates when they exist then
    begin
    insert
    exception
    when dup_value_in_index then null;
    end
    would be the way to code this one. The bulk insert version has in 9.2 the ability to store the errors so that they can all be handled at once which means the rest of the array insert can work.
    HTH -- Mark D Powell --

  • CHECK for duplicate inside a cursor and pass a ouptut parameter in sql server 2008

    Hi All,
    I am inserting a value into a table, Before inserting i am checking that record already exists or not in the target table, If its existsing i am making an entry into errorlog table and set the output parameter to 'errorlog' . This is inside the cursor, as
    il be passing multiple values. Next is I have separate query to get the new record which is not in the target table. Using EXCEPT i get the new record and i insert into a main table. after insertion i set output as 'success'. 
    Here while executing the procedure i pass a duplicate value and a new value. As it is in cursor,first it will insert into errorlog and set output parameter as 'errorlog' .Next it will insert a new record into main table and set output parameter as 'Success'.
    So on completion of the execution of the procedure i get output as success.
    But i should get as errorlog. I should get success only on no errors in the procedure. How i can i achieve this? Please help me.
    Below is my code
    IF NOT EXISTS(SELECT Beginmilepost,BeginTrackName,Endmilepost,EndTrackName
    FROM SSDB_Segment WHERE BeginMilepost>=@BegMP AND EndMilepost<=@EndMP AND SearchID = @SearchID AND Reference = 'Range')
    BEGIN
                     Declare C_Max1 Cursor FOR
    (SELECT Beginmilepost,BeginTrackName,Endmilepost,EndTrackName FROM SSDB_Segment WHERE BeginMilepost = @BegMP AND EndMilepost = @EndMP AND  BeginTrackName = @BegtrkName 
    AND EndTrackName = @EndTrkName  AND SearchID = @SearchID)
      Open C_Max1
      FETCH FROM C_MAX1 INTO @BeginMilepost,@BTrackName,@EndMilepost,@ETrackName
    WHILE(@@FETCH_STATUS=0)
    BEGIN
    IF OBJECT_ID ('tempdb..#temp') IS NOT NULL
    BEGIN
          DROP TABLE #temp
    END--IF
    Select BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix,EndLatitude,EndLongitude,EndTrackName,EndMilepost,TrainType into #temp
    FROM
    SELECT BeginLatitude= case when @BegLat = 0 THEN NULL ELSE @BegLat end ,BeginLongitude= case when @BegLong=0 THEN NULL ELSE @BEgLong end ,@BTrackName AS BeginTrackName,ROUND(@BeginMilepost ,3) AS BeginMilepost,
    BeginMilepostPrefix= CASE WHEN @BegPrefix = 'null' THEN NULL ELSE @BegPrefix END,BeginMilepostSuffix= CASE WHEN @BegSuffix  = 'null' THEN NULL ELSE @BegSuffix  END,
    EndLatitude=case when @EndLat =0 then NULL else @EndLat end,EndLongitude=case when @Endlong = 0 THEN NULL ELSE @Endlong END,@ETrackName AS EndTrackName,ROUND(@EndMilepost ,3) AS EndMilepost,@TrainType AS TrainType 
    UNION ALL
    select BeginLatitude,BeginLongitude,BeginTrackName,ROUND(BeginMilepost,3) AS BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix, EndLatitude,EndLongitude,EndTrackName,ROUND(EndMilepost,3) AS EndMilepost,TrainType from SSDB_MaximumPermissibleSpeed)data
    group by  BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,EndLatitude,EndLongitude,EndTrackName,EndMilepost,BeginMilepostPrefix,BeginMilepostSuffix,TrainType
    having COUNT(*)>1
    SET @COUNT= (select count(*) from #temp )
    Print @COUNT
    IF @COUNT>=1
    BEGIN
     INSERT INTO ErrorLog_Asset (
                                        ErrorCode,
                                        ErrorMessage,
                                        TableName,
                                        MilepostPrefix,
                                        Milepost
    SELECT
                                     '1',
                                     'Already exists at BeginMp '+ CAST(@BeginMilepost  as varchar) +',EndMp '+ CAST(@EndMilepost as varchar) +' ,Beginlat
    '+CAST(@BegLat   as varchar)
                                     +' ,Endlat '+CAST(@EndLat   as varchar)+', BeginTrackName '+@BTrackName  +' and EndTrackName '+@ETrackName
                                     'MaximumPermissibleSpeed',
                                      CASE WHEN @BegPrefix = 'null' THEN NULL
    ELSE @BegPrefix END ,
    @BeginMilepost  
    SET @output = 'Errorlog'
    END
     IF OBJECT_ID ('tempdb..#Max') IS NOT NULL
    BEGIN
     DROP TABLE #Max
    END--IF
     Select BeginLatitude,BeginLongitude,BeginTrackName,BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix,EndLatitude,EndLongitude,EndTrackName,EndMilepost,TrainType into #Max from
           (SELECT BeginLatitude= case when @BegLat = 0 THEN NULL ELSE @BegLat end ,BeginLongitude= case when @BegLong=0 THEN NULL ELSE @BEgLong end ,@BTrackName AS BeginTrackName,ROUND(@BeginMilepost ,3)
    AS BeginMilepost,
                  BeginMilepostPrefix= CASE WHEN @BegPrefix = 'null' THEN NULL ELSE @BegPrefix END,BeginMilepostSuffix= CASE WHEN @BegSuffix  = 'null' THEN NULL ELSE @BegSuffix  END,
                  EndLatitude=case when @EndLat =0 then NULL else @EndLat end,EndLongitude=case when @Endlong = 0 THEN NULL ELSE @Endlong END,@ETrackName AS EndTrackName,ROUND(@EndMilepost ,3) AS EndMilepost,@TrainType AS TrainType 
    except
                 select BeginLatitude,BeginLongitude,BeginTrackName,ROUND(BeginMilepost,3) AS BeginMilepost,BeginMilepostPrefix,BeginMilepostSuffix, EndLatitude,EndLongitude,EndTrackName,ROUND(EndMilepost,3) AS EndMilepost,TrainType
    from SSDB_MaximumPermissibleSpeed)data
     Declare C_Max2 Cursor FOR
     Select BeginMilepost,BeginTrackName,EndMilepost,EndTrackName from #Max 
      Open C_Max2
      FETCH FROM C_Max2 INTO  @BeginMP,@BeginTrackName,@EnMP,@EnTrackName
    WHILE(@@FETCH_STATUS=0)
    BEGIN
       IF (Select COUNT(*) from tbl_Trackname )>=1
       BEGIN
     IF (@TrainType IN (SELECT TrainType  FROM SSDB_TrainType )AND (@Speed <>0) AND @BeginMP IS NOT NULL AND @BeginTrackName IS NOT NULL  AND @EnMP IS NOT NULL
     AND @Direction IN (SELECT Direction FROM SSDB_Direction) AND @EnTrackName IS NOT NULL )
     BEGIN-------------
     SET @ID = (Select MAX(MaximumpermissibleSpeedID) from SSDB_MaximumPermissibleSpeed)
    IF @COUNT =0
       BEGIN
                          INSERT INTO SSDB_MaximumPermissibleSpeed
    BeginMilepostPrefix,
    BeginMilepostSuffix,
    BeginMilepost,
    BeginTrackName,
    BeginLatitude,
    BeginLongitude,
    BeginElevation,
    EndMilepostPrefix,
    EndMilepostSuffix,
    EndMilepost,
    EndTrackName,
    EndLatitude,
    EndLongitude,
    EndElevation,
    Direction,
    Speed,
    TrainType,
    Description,
    InsertUser,
    S_ID
                                                     SELECT
      CASE WHEN @BegPrefix = 'null' THEN NULL
      ELSE @BegPrefix END,
                          CASE WHEN @BegSuffix = 'null' THEN NULL
      ELSE @BegSuffix END,
      @BeginMP ,
      @BeginTrackName  ,
      case WHEN @BegLat = 0 THEN NULL
      ELSE @BegLat END,
      CASE WHEN @BegLong=0 THEN NULL
      ELSE @BegLong END ,
      CASE WHEN @BegEle = 0 THEN NULL
      ELSE @BegEle END ,
      CASE WHEN @EndPrefix = 'null' THEN NULL
      ELSE @EndPrefix END,
                          CASE WHEN @EndSuffix = 'null' THEN NULL
      ELSE @EndSuffix END,
      @EnMP ,
      @EnTrackName  ,
      case WHEN @EndLat = 0 THEN NULL
      ELSE @EndLat END,
      CASE WHEN @EndLong=0 THEN NULL
      ELSE @EndLong END ,
      CASE WHEN @EndEle = 0 THEN NULL
      ELSE @EndEle END ,
      @Direction ,
      @Speed ,
      @TrainType ,
      CASE WHEN @Description ='null' THEN NULL
      ELSE @Description END ,
      @InsertUser ,
      @UID     
    INSERT INTO SSDB_MaxSpeed_History
                       MSID,
    BeginMilepostPrefix,
    BeginMilepostSuffix,
    BeginMilepost,
    BeginTrackName,
    BeginLatitude,
    BeginLongitude,
    BeginElevation,
    EndMilepostPrefix,
    EndMilepostSuffix,
    EndMilepost,
    EndTrackName,
    EndLatitude,
    EndLongitude,
    EndElevation,
    Direction,
    Speed,
    TrainType,
    Description,
    S_ID,
    NOTES ,
    [Action] ,
    InsertUser
                                 SELECT 
                          (Select MaximumPermissibleSpeedID from SSDB_MaximumpermissibleSpeed WHERE MaximumPermissibleSpeedID > @ID),
                          CASE WHEN @BegPrefix = 'null' THEN NULL
      ELSE @BegPrefix END,
                          CASE WHEN @BegSuffix = 'null' THEN NULL
      ELSE @BegSuffix END,
      @BeginMP ,
      @BeginTrackName  ,
      case WHEN @BegLat = 0 THEN NULL
      ELSE @BegLat END,
      CASE WHEN @BegLong=0 THEN NULL
      ELSE @BegLong END ,
      CASE WHEN @BegEle = 0 THEN NULL
      ELSE @BegEle END ,
      CASE WHEN @EndPrefix = 'null' THEN NULL
      ELSE @EndPrefix END,
                          CASE WHEN @EndSuffix = 'null' THEN NULL
      ELSE @EndSuffix END,
      @EnMP ,
      @EnTrackName  ,
      case WHEN @EndLat = 0 THEN NULL
      ELSE @EndLat END,
      CASE WHEN @EndLong=0 THEN NULL
      ELSE @EndLong END ,
      CASE WHEN @EndEle = 0 THEN NULL
      ELSE @EndEle END ,
      @Direction ,
      @Speed ,
      @TrainType ,
      CASE WHEN @Description ='null' THEN NULL
      ELSE @Description END ,
      @UID,
      NULL,
      'INSERT',
      @InsertUser 
    set @output='Success'
    --IF ((@COUNT >=1) AND (@COUNT =0))
    --BEGIN
    --  SET @output = 'ErrorLog'
    --END
    --IF (@COUNT = 0)
    -- BEGIN
    --SET @output ='Success'
    --END
    --END
    END
    END------------------------> 
    Deepa

    Hi Deepa,
    If I understand your question correctly, you would like the @Output parameter to contain the value "Success" only if all rows were successful. As soon as one row was found to be a duplicate, the value of @Output at the end of execution should be "ErrorLog".
    Currently, you modify the value of @Output in each iteration of the cursor, so at the end of execution you're left with the last value.
    In order to change that to work the way you want it, you need to set the value of @Output in the beginning of execution (before entering the cursor) to "Success", and as soon as there is a duplicate row, you should modify the value to "ErrorLog". This way,
    if all rows are successful, the value of @Output will be "Success" at the end of execution. On the other hand, if there is even a single duplicate row, the value of @Output will be "ErrorLog" at the end of execution.
    I hope this helps...
    Guy Glantser
    SQL Server Consultant & Instructor
    Madeira - SQL Server Services
    http://www.madeirasql.com

  • How to rewrite this query to avoid duplicates , please

    Hello Good Morning All,
    Happy New Year,
    Could you please help to rewrite the below two queries (so that i can avoid duplicates) i need to send email to everyone not the dupllicated ones), please?
    Create table #MyPhoneList
     AccountID int,
     EmailWork varchar(50),
     EmailHome varchar(50),
     EmailOther varchar(50),
     IsOffersToWorkEmail bit,
     IsOffersToHomeEmail bit,
     IsOffersToOtherEmail bit,
     IsValidEmailWork bit,
     IsValidEmailHome bit,
     IsValidEmailOther bit
    --> In this table AccountID is uniquee
    --> email values could be null or repetetive for work / home / Other (same email can be used more than one columns for accountid)
    -- a new column will be created with name as Sourceflag( the value could be work, Home, Other depend on email coming from) then removes duplicates
    SELECT AccountID , Email, SourceFlag, ROW_NUMBER() OVER(PARTITION BY AccountID, Email ORDER BY Sourceflag desc) AS ROW
    INTO #List
    from (
      SELECT AccountID
         , EmailWork      AS EMAIL
         , 'Work'       AS SourceFlag
      FROM #MyPhoneList (NoLock) eml
      WHERE IsOffersToWorkEmail    = 1
      AND  EMAILWORK      IS NOT NULL
      AND  IsValidEmailWork    = 1
     UNION
      SELECT AccountID
         , EmailHome  
         , 'Home'       AS SourceFlag
      FROM #MyPhoneList (NoLock) eml
      WHERE IsOffersToHomeEmail    = 1
      AND  EMAILHOME      IS NOT NULL
      AND  IsValidEmailHome    = 1
     UNION
      SELECT AccountID
         , EmailOther  
         , 'Other'       AS Sourceflag
      FROM #MyPhoneList (NoLock) eml
      WHERE EmailOther      = 1
      AND  EMAILOther      IS NOT NULL
      AND  IsValidEmailOther    = 1
     ) eml --select count(*) from #email
    --Email dedupe on source
    SELECT * INTO #distinct FROM #List WHERE ROW  = 1
    Thank you in Advance
    Milan

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> Could you please help to rewrite the below two queries (so that I can avoid duplicates) I need to send email to everyone not the duplicated ones), please? <<
    This mess is not a table because it has no keys, not way to have a key. You are using UNION like we used punch card merges in the o9ld days. 
    What math do you do on the account_id? That is the only reason that you use numeric values Why do you think that an email is fifty characters long? Yes, most them are, but did you bother to look at the maximum length? NO! Why did you name it “Phone_List” when
    it is nothing but email addresses? emails are not phones.  
    Please read this article so you will know why RDBMS does not use assembly language flags like you are doing. 
    https://www.simple-talk.com/sql/t-sql-programming/bit-of-a-problem/
    It would also help if you know what normalization was. Here is one design that is valid. 
    CREATE TABLE Something_emails 
    (account_id CHAR(15) NOT NULL,
     email_address VARCHAR(256) NOT NULL,
     email_type CHAR(5) NOT NULL
     CHECK (email_type IN ('home', 'work', 'misc')),
     PRIMARY KEY (email_address, email_type)
    >> In this table account_id is unique <<
    No, not without the DDL you did not post.
    >> email values could be NULL or repetitive for work / home / Other (same email can be used more than one columns for account_id) <<
    Not a problem. Look at the primary key.  Also why would anyone store invalid data in a table? SQL programmers try to keep it out! 
    >> a new column will be created with name as Source_flag (the value could be work, Home, Other depend on email coming from) then removes duplicates <<
    More kludges! Oh, putting the comma at the front of a line is how non-SQL mimic punch cards. An SQL progtrqammer would put related subsets of columns on one line – we think in sets! After 30+ years of SQL, this is one of the code smells I use to find bad
    code. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Duplicate rows in Record grp "Cust_sytem"  in form "OKSITMSL"

    Hi,
    We are using Service contracts in Production environment.
    Duplicate rows selected for LOV query.
    By adding a line userenv('language') we solve the problem.
    But the coding was written inside the standard "OKSITMSL.pll". Here For the Field "NAME", LOV
    record group "CUST_SYSTEM" assigned dynamically based on
    other fields "ITEMSEL.FILTER = SYSTEM" and "ITEMSEL.CUSTOMER_FILTER = CUSTOMER".
    I have added piece of the details below.
    Form is Standard form "OKSITMSL", Which is calling om parent form "OKSAUDET".
    Form : OKSITMSL
    Block : ITEMSEL
    field : NAME
    pll : OKSITMSL.pll
    oksitmsl.pll coding-------------
    ELSIF NAME_IN('ITEMSEL.FILTER') = 'System' THEN
    If UPPER(Name_In('ITEMSEL.CUSTOMER_FILTER')) = 'CUSTOMER' then
    l_group_name := 'CUST_SYSTEM';
    Elsif UPPER(Name_In('ITEMSEL.CUSTOMER_FILTER')) = 'RELATED' then
    l_group_name := 'REL_CUST_SYSTEM';
    Elsif UPPER(Name_In('ITEMSEL.CUSTOMER_FILTER')) = 'BOTH' then
    l_group_name := 'BOTH_SYSTEM';
    Elsif UPPER(Name_In('ITEMSEL.CUSTOMER_FILTER')) = 'ALL' then
    l_group_name := 'OKS_SYSTEM';
    End If;
    Set_Lov_Property('ITEMSEL_LEVEL', GROUP_NAME, l_group_name);
    “CUST_SYSTEM” Record group present in “OKSITMSL” form.
    I need the advice how to solve my problem by adding a line in query of "CUST_SYSTEM" record group without touching/alter standard form.
    Thanks in advance.
    Navas

    Of course you can/should do additional validations on the client as needed basing on your requirement, there is nothing wrong with that. If you can't afford the roundtrip to the database than by all means: do everything you can to permit it if it's not allowed anyway.
    But even if you do checks on the client side you must not forget that you are in a multi user environment and you can't check for duplicates of uncommited data in another session. Also let's not forget that you might not be the only one jamming data into your database, and if you don't enforce it with a constraint another application actually could create duplicates because the developers forgot to implement a unique check. So the only way to be 100% sure you cannot pile duplicates into the database is a constraint.
    My point is:
    - always create a constraint when you want to enforce uniqueness => this is a must
    - if needed do additional checkings on the client to make users life easier => optional and can be implemented as needed
    From what I see mostly the first point get's ignored, and the second get's implemented. The implementations most of the time utterly fail when I start the application twice and enter the same data in two different sessions. Now I have a serious problem, as data which is supposed to be unique isn't unique anymore. too_many_rows are going to happen in every corner of the application, and nobody knows why.
    cheers

Maybe you are looking for

  • BI-IP Characteristic Rel. Part 2

    Hi I have edited the code under method Derive with no syntax errors. Now when I activate the code, I get the following error message: Class ZCL_RSPLS_CR_EXIT_0FISCPER,Public Section     26     @0A\QError@ Implementation missing for method "CONSTRUCTO

  • CS3 and PowerPC Mac - can't get Photoshop CS3 to install

    I'm using a PowerPC based Mac - OSX v 10.4.11. I tried to install the CS3 suite - some apps installed fine, some did not. Photoshop CS3 did not install. Now when I try to use PS CS2 quite a few features are missing, particularly in the filters menu.

  • Error opening external DTD 'Segnatura.dtd' using dbms_xmlsave.insertXML

    I've been trying to insert a document in a table. All works fine if the xml doesn't contains the doctype element! If I add the row <!DOCTYPE Segnatura SYSTEM "Segnatura.dtd"> to my xml I get the error: oracle.xml.sql.OracleXMLSQLException: Error open

  • Lightroom 5.6 won't import raw files from Nikon D750

    I have Lightroom 5.6 and it will not import RAW files from my Nikon D750.  Any thoughts?

  • ORA-22816: unsupported feature with RETURNING clause

    My database is: 10g 10.2.0.3.0 Sorry this is a little long but I need some help! The insert is being done in PLSQL with SQL. I am trying to Insert a row into a view the view has 3 Instead of triggers. (insert, update, delete) I have looked up this er