Duplicate rows in meterilized views

we have a materialized view refresh jobs which run using dbms_scheduler every morning .
DBMS_MVIEW.REFRESH( LIST => 'SUBSCRIBER', METHOD => 'C', atomic_refresh => FALSE );
strangely today morning we noted duplicate rows in the Mview ,
i ran this mview refresh manually ,there are no duplicates now
could you guys face this king of problem any time ,could you guss what could be problem for thsi
thanks
-AK

tt0008 wrote:
we have a materialized view refresh jobs which run using dbms_scheduler every morning .
DBMS_MVIEW.REFRESH( LIST => 'SUBSCRIBER', METHOD => 'C', atomic_refresh => FALSE );
strangely today morning we noted duplicate rows in the Mview ,
i ran this mview refresh manually ,there are no duplicates now
could you guys face this king of problem any time ,could you guss what could be problem for thsi Something in the source data that was there and no longer is?
Check the underlying SQL of the MV very carefully
Also check the SQL used to query the MV to find the duplicates

Similar Messages

  • Find Duplicate Rows

    Hi,
    I have to find duplicate rows from a view where 2 columns of the view should be duplicate but the 3 col value should not be same.
    Pls help it's urgent.
    Thanks
    Regards
    Prashant

    Try this
    with t
    as
    select 1 rno, 'AAA' c1, 1 c2, 'NAME1' c3 from dual union all
    select 2, 'AAA', 1, 'NAME1' from dual union all
    select 3, 'AAA', 1, 'NAME3' from dual union all
    select 4, 'BBB', 2, 'NAME4' from dual union all
    select 5, 'BBB', 2, 'NAME4' from dual union all
    select 6, 'BBB', 2, 'NAME5' from dual
    select rno, c1, c2, c3
      from (
             select t.*, row_number() over(partition by c1, c2, c3 order by rno) rno1
               from t
    where rno1 = 1

  • How to Create primary key index with duplicate rows.

    Hi All,
    While rebuilding an index on a table , I am getting error that there are duplicate rows in a table.
    Searching out the reason led me to an interesting observation.
    Please follow.
    SELECT * FROM user_ind_columns WHERE table_name='SERVICE_STATUS';
    INDEX_NAME     TABLE_NAME     COLUMN_NAME     COLUMN_POSITION     COLUMN_LENGTH     CHAR_LENGTH     DESCEND
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO_RESETS     2     22     0      ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     STATUS_TYPE_ID     3     22     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     ACTIVE_DT     4     7     0     ASC
    SERVICE_STATUS_PK     SERVICE_STATUS     SUBSCR_NO     1     22     0     ASC
    SELECT index_name,index_type,table_name,table_type,uniqueness, status,partitioned FROM user_indexes WHERE index_name='SERVICE_STATUS_PK';
    INDEX_NAME     INDEX_TYPE      TABLE_NAME     TABLE_TYPE     UNIQUENESS     STATUS     PARTITIONED
    SERVICE_STATUS_PK     NORMAL     SERVICE_STATUS     TABLE     UNIQUE     VALID     NO
    SELECT constraint_name ,constraint_type,table_name,status,DEFERRABLE,DEFERRED,validated,index_name
    FROM user_constraints WHERE constraint_name='SERVICE_STATUS_PK';
    CONSTRAINT_NAME     CONSTRAINT_TYPE     TABLE_NAME      STATUS     DEFERRABLE     DEFERRED     VALIDATED     INDEX_NAME
    SERVICE_STATUS_PK     P     SERVICE_STATUS     ENABLED     NOT DEFERRABLE     IMMEDIATE VALIDATED     SERVICE_STATUS_PK
    1. Using index scan:
    SELECT COUNT (*)
    FROM (SELECT subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    no rows returned
    Explain plan:
    Operation     OBJECT Name     ROWS     Bytes     Cost     OBJECT Node     IN/OUT     PStart     PStop
    SELECT STATEMENT Optimizer MODE=CHOOSE          519 K          14756                     
    FILTER                                        
    SORT GROUP BY NOSORT          519 K     7 M     14756                     
    INDEX FULL SCAN     ARBOR.SERVICE_STATUS_PK     10 M     158 M     49184                     
    2. Using Full scan:
    SELECT COUNT (*)
    FROM (SELECT /*+ full(s) */ subscr_no, active_dt, status_type_id, subscr_no_resets
    FROM service_status s
    GROUP BY subscr_no, active_dt, status_type_id, subscr_no_resets
    HAVING COUNT (*) > 1) ;
    71054 rows returned.
    Explain Plan:
    Operation     Object Name     Rows     Bytes     Cost     Object Node     In/Out     PStart     PStop
    SELECT STATEMENT Optimizer Mode=CHOOSE          1           24123                     
    SORT AGGREGATE          1                               
    VIEW          519 K          24123                     
    FILTER                                        
    SORT GROUP BY          519 K     7 M     24123                     
    TABLE ACCESS FULL     ARBOR.SERVICE_STATUS     10 M     158 M     4234                     
    Index SERVICE_STATUS_PK is a unique and composite primary key VALID index. And the constraint is ENABLED and VALIDATED still having duplicate rows in table.
    How it is possible?
    Is it an Oracle soft Bug??
    Regards,
    Saket Bansal

    saket bansal wrote:
    Values are inserted as single rows inserts through an GUI interface.And you still claim to have over 71K duplicate records, without the GUI getting any kind of errors?
    That does not add up and can only be explained by a "bug".
    I tried inserting a duplicate record but failed.
    SQL> insert into service_status (select * from service_status where rownum <2);
    insert into service_status (select * from service_status where rownum <2)
    ERROR at line 1:
    ORA-00001: unique constraint (ARBOR.SERVICE_STATUS_PK) violatedAre you really sure there is no other way data in this table is populated/manipulated in bulk?

  • Duplicate rows displayed in list

    I am using ADF, Struts and JSP.
    On occasion, some of the pages that simply display a list of attibutes in a VO display duplicate rows - these views reference just one EO and in the majority of cases all of the default settings are used.
    There seems to be no consistency as to what causes this, at first it would appear after a new row had been inserted but then is would just appear when listing the detilas.
    If you refresh the list (event invokes executeQuery() to refresh the data from the DB) then the duplicate row goes away.
    This happens on my development machine (using JDev 10.1.2) and on the Application Server deployment.
    Has anyone esle seen this?
    Does anyone know why this might be happening and what I can do to solve this problem?
    Thanks
    Alan

    Marcos - thanks for the reply - this is the type of answer I was looking for since I'm not able to find anywhere in my code that I'm inserting a new row.
    However, I've tried this approach and am still experiencing the issue. I wanted to check that I had the right items checked / not checked. I don't have an item that says Disconnect Application Module 'unmanaged Release' - mine just says 'Release'. Here are my options (Jdev 10.1.3):
    (default unchecked) Failover Transaction State Upon Managed Release
    (default unchecked) Disconnect Application Module Upon Release
    (default checked) Support Dynamic JDBC Credentials
    (default checked) Reset Non-Transcational State Upon Unmanaged Release
    (default checked) Enable Application Module Pooing
    I've tried multiple combinations of checking / un-checking options (including having everything checked except the 2nd item above) and still get the same issue. I'm going to read up in the developer guide to see if I can understand these better.
    By the way, can you let me know which passivate state options you have set for your View Object that was showing the duplicate row but is now working? For example, right-click on VO, select edit - what items are checked on the Tuning tab?
    #1 Fill Last Page of Rows when Paging through Rowset
    #2 Passivate State
    #2a Including all Transient Values
    #3 Retain View Link Accessor
    Thanks

  • Hide duplicate rows in Cross Tab report

    where can i find the option to hide duplicate rows in cross tab report..?

    Is it a limitation with crosstab report..?
    Ok, here's the issue i have a crosstab report and its based on a VIEW.
    the data duplicates based on created_by and last_updated_by columns as I'm not using these columns in the report.
    any ideas or workarounds to avoid duplicates....?
    Thanks!

  • Using JHS 'Duplicate Row' Feature In Form

    I am having a minor set back in implementing the JHeadstart duplicateRow() method in a Form (opposed to the default Table-view).
    In table-view the duplicateRow() method of the JhsCollectionModel works flawlessly with items that are set to Update Allowed?: while_new. When we use the method in a Form view however, items remain non-updateable after the Duplicate Row button has be pressed. This prevent rows from being copied within the given Form view page.
    I do not understand how this is occuring since row.setNewRowState(Row.STATUS_NEW) is being called within the duplicateRow() method. Is another object (other than oracle.jbo.Row) that needs to be used in Form view instead of Table view in order to perform this functionality?
    Thanks

    Well, after an entire day of playing around, I was finally able to get a proper call to the onCreate() method. I figure out that I could make a hard-coded call to:
    oracle.binding.OperationBinding opBinding = getBindings().getOperationBinding("CreateCampus"); ...to get a OperationBinding interface to a FacesCtrlActionBinding (which extends JUCtrlActionBinding). With a simple cast, this allowed me to make a call to JhsPageLifecycle.onCreate().
    Unfortunately, when the rest of my algorithm runs, it's not "copying" over any of the non-PK row values (as it normally does before I implemented this logic).
    So to simplify things: Has anyone ever coded a simple single-row copying ADF Faces/ADF BC feature before that would work in both Table and Form views? Or, how easily could the JHeadstart duplicateRow() feature be extended to work in Form-view?
    If I can see how a simple shallow copy is supposed to operate within the use of JHeadstart, I think I can extend it for our "deep copying' requirement.
    Thanks.

  • Help with remove reversed duplicate rows?

    Hi:
    I have an application where I need to remove reversed duplicate rows, such as this:
    select 'A' x, 'B' y from dual
    union all
    select 'C', 'D' from dual
    union all
    select 'B','A' from dual;
    Output is:
    X Y
    A B
    C D
    B A
    What I need is to remove the 'B A' row because it already exists in reverse form as 'A B'. It does not matter which row is kept, 'A B' or 'B A'. Just one of them needs to be removed and the other needs to stay.
    Note that the actual query to generate the data is a little more involved, but I can use a with clause to make it an inline view. I'm hoping that the actual mechanics are not relevant. If that is not the case, please let me know and I'll post more details about the actual query.
    Any ideas?

      WITH T AS
    ( SELECT  'HOUSE' x, 'HOUSE' y FROM DUAL UNION ALL
    SELECT 'HOUSE', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'JME4Q08' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'JMEM' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'MATCH3' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'PGCM' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'PGCU' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'VEL' FROM DUAL UNION ALL
    SELECT 'HOUSE', 'XXX08' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'MATCH3' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'PGCM' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'PGCU' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'VEL' FROM DUAL UNION ALL
    SELECT 'JME0609U', 'XXX08' FROM DUAL UNION ALL
    SELECT 'JMEM', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'JMEM', 'JMEM' FROM DUAL UNION ALL
    SELECT 'JMEM', 'MATCH3' FROM DUAL UNION ALL
    SELECT 'JMEM', 'PGCM' FROM DUAL UNION ALL
    SELECT 'JMEM', 'PGCU' FROM DUAL UNION ALL
    SELECT 'JMEM', 'VEL' FROM DUAL UNION ALL
    SELECT 'JMEM', 'XXX08' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'MATCH3' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'PGCM' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'PGCU' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'VEL' FROM DUAL UNION ALL
    SELECT 'MATCH2', 'XXX08' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'JMEM' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'MATCH3' FROM DUAL UNION ALL
    SELECT 'MATCH3', 'XXX08' FROM DUAL UNION ALL
    SELECT 'PGCM', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'PGCM', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'PGCM', 'JMEM' FROM DUAL UNION ALL
    SELECT 'PGCM', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'PGCM', 'PGCM' FROM DUAL UNION ALL
    SELECT 'PGCM', 'XXX08' FROM DUAL UNION ALL
    SELECT 'PGCU', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'PGCU', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'PGCU', 'JMEM' FROM DUAL UNION ALL
    SELECT 'PGCU', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'PGCU', 'PGCU' FROM DUAL UNION ALL
    SELECT 'PGCU', 'XXX08' FROM DUAL UNION ALL
    SELECT 'VEL', 'HOUSE' FROM DUAL UNION ALL
    SELECT 'VEL', 'JME0609U' FROM DUAL UNION ALL
    SELECT 'VEL', 'JMEM' FROM DUAL UNION ALL
    SELECT 'VEL', 'MATCH2' FROM DUAL UNION ALL
    SELECT 'VEL', 'VEL' FROM DUAL UNION ALL
    SELECT 'VEL', 'XXX08' FROM DUAL )
    SELECT x, y
    FROM   (SELECT x, y, row_number() over (partition by least(x,y), greatest(x,y) order by rownum) rn
            FROM   t)
    WHERE  rn = 1
    HOUSE,HOUSE
    HOUSE,JME0609U
    HOUSE,JME4Q08
    HOUSE,JMEM
    HOUSE,MATCH2
    HOUSE,MATCH3
    HOUSE,PGCM
    HOUSE,PGCU
    HOUSE,VEL
    HOUSE,XXX08
    JME0609U,JME0609U
    JME0609U,MATCH3
    JME0609U,PGCM
    JME0609U,PGCU
    JME0609U,VEL
    JME0609U,XXX08
    JMEM,JMEM
    JMEM,MATCH3
    JMEM,PGCM
    JMEM,PGCU
    JMEM,VEL
    JMEM,XXX08
    MATCH2,MATCH2
    MATCH2,MATCH3
    MATCH2,PGCM
    MATCH2,PGCU
    MATCH2,VEL
    MATCH2,XXX08
    MATCH3,MATCH3
    MATCH3,XXX08
    PGCM,PGCM
    PGCM,XXX08
    PGCU,PGCU
    PGCU,XXX08
    VEL,VEL
    VEL,XXX08

  • Duplicate row data question.

    Hello:
    I am working on displaying data from ms sql server onto a jsp. data contains metrics about number of views for each portal module/application.
    The back end SQL query gives me 5 columns -
    1.report_date
    2.unique users
    3.max_users
    4.module_name
    5.views
    I want to display (in the jsp) one set of row for each report date, but my resultset has multiple data for same date, each with different module_name and views. The other column data (2,3) is the same.
    I need to break "views" up under the appropriate module_name column and put there "views".
    Is there a way i can use hashmap or arraylist to load the resultset and then create one row per report date with various module_name and there views?
    Any useful input will be greatly appreciated.
    Jharsh

    Thanks Mchan, i think my question title is confusing.
    I don;t really have duplicate rows, my data has multiple rows but different data under column - module_name,views: for the same "report_date" , and i want to display these in one row for that report_date.
    jharsh
    This is what i am basically trying to achieve:
    report_date max_users max_concur_users module_name views
    06/02/2006 10 12 XYZ 6
    05/01/2006 13 9 ABC 7
    12/23/2005 11 7 EFG 9
    12/23/2005 11 7 HIJ 4
    I need to diplay this in the jsp in the below format:
    report_date max_users max_concur_users XYZ ABC EFG HIJ
    06/02/2006 10 12 6 0 0 0
    05/01/2006 13 9 0 7 0 0
    12/23/2005 11 7 0 0 9 4
    Message was edited by:
    jharsh

  • Returning Duplicate Rows

    Hi. I'm working on this query, and I'm having problems. When I add an inner join, I start getting multiple rows returned.
    What I want returned is ONLY the first row below, but I'm instead getting both rows (which are identical).
    SALESMAN_NO | CUSTOMER_NO | ORDER | SALES | COGS | MARGIN
    97 | 1306969000 | 00477023 | 517.40 | 298.20 | 219.18
    97 | 1306969000 | 00477023 | 517.40 | 298.20 | 219.18
    Here's my query. And when I add the inner joins, I get the 2nd row above. If I run the SAME query without the inner joins, I get the 1 and only 1 row - which is what I'm trying to get to. Getting this 2nd row is screwing up the SUM functions I'm ultimately trying to use.
    SELECT
    SOE.SALESMAN_NO AS [SALESMAN],
    SOE.CUSTOMER_NO AS [CUSTOMER #],
    (SOE.SALE_ORDER_NO) AS [ORDERS],
    (SOE.SALES_AMT/100) AS [SALES],
    (SOE.COST_GOODS_SOLD/100) AS [COGS],
    ((SOE.SALES_AMT/100) - (SOE.COST_GOODS_SOLD/100)) AS [MARGIN]
    FROM
    SOE_HEADER SOE
    INNER JOIN CUST_NAME CUST
    ON SOE.CUSTOMER_NO = CUST.CUSTOMER_NO
    INNER JOIN OUTSIDE_SALES OUTSIDE
    ON CUST.SALESMAN_NO = OUTSIDE.SALESMAN_NO
    WHERE
    SOE.SALESMAN_NO <> '83'
    AND SOE.TYPE_OF_ORDER = '00'
    AND SOE.ORDERS_STATUS = '06'
    AND SOE.DATE_OF_ORDER > 20080101
    AND SOE.TYPE_OF_FRGHT IN ('13','14')
    AND SOE.CUSTOMER_NO = '1306969000'
    I've looked at the data and at this query for about an hour now, and need some help. Thanks.

    If you want to get the distinct rows only in this SELECT then you may use DISTINCT. ie replace the table with a query
    ,(Select Distinct SALESMAN_NO,CUSTOMER_NO, ORDER  SALES ,COGS , MARGIN From YourTableName) AS AliasName
    Check this too
    Find and/or Delete Duplicate Rows
    http://code.msdn.microsoft.com/SQLExamples/Wiki/View.aspx?title=DuplicateRows&referringTitle=Home
    Madhu
    SQL Server Blog
    SQL Server 2008 Blog

  • Report Builder 2.0 returning duplicate rows in query designer

    Hi,
    I have a query running off a model, when I explore the data in the model and in a standard sql table it returns one row for each record, which include a unique id for each which is correct.
    When I go into report builder query designer, it shows duplicate rows for each record. I have removed and added fields to try and pin point why and the only reason i can come up with is that it runs fine until I add in a field thats varchar(255) or
    varchar(max). This is when it starts to duplicate the records.
    Can anyone tell me why it does this or point me in the direction of how to stop this. I can't edit the query in text to add DISTINCT so thats not an option.
    Many thanks,
    JJSJ

    OK - I have found a partial answer.   By Googling Report Builder and VARCHAR, I found another post which reported problems with the semantic query builder when the underlying table/view was returning columns of type VARCHAR(MAX).   
    On looking at the length setting for the data column in the DSV,  this reported a length of 2,147,483,647 for this field.   This is very odd because on querying the underlying table the largest length that I can find for this column is 191,086
    (which is far larger than I would have expected - I am investigating this separately).
    However, why should the Report Model think that this field contains such a large value?
    Anyway,  the other post that I found reported that they had solved their problem by converting the field to a VARCHAR (255).    I tried this (by casting the column in my View to VARCHAR(255))  and this resolved the problem
    - no more duplicate rows when adding this field to the query!!!
    I also tried CASTING to TEXT and to VARCHAR(8000).  The former did not resolve the problem; the latter did.
    So I have a workaround but I don't understand why.  
    Can anybody explain why having a VARCHAR(max) column in my entity causes duplicate rows.    
    I suspect it is to do with the fact that for some reason the Report Model seems to think that there is an exceptionally long text string stored in this column in one of the rows but that again is a puzzle.
    Thanks
    Richard

  • How to make "Duplicate Row" button work with LOV

    Hi,
    I am using JDeveloper version: Studio Edition Version 10.1.3.1.0.3984
    JHeadstart version: 10.1.3.1 Release 10.1.3.1.26
    We have a VO where there are 2 EOs - one is Updatable and one is Reference.
    We are using Association for the Reference EO.
    In the page we have a LOV and from the LOV we are redirecting some fields including some fields for the Reference EO (to show only).
    Everything works fine.
    But the problem is, - we checked the "Show Duplicate Row Button?" option in the Application Definition file.
    when we click the "Duplicate Row" button then we get the error:
    javax.faces.el.EvaluationException: oracle.jbo.ReadOnlyAttrException: JBO-27008: Attribute set for UserId in view object Userpermission_under_Personalinfo_View_for_Owner failed
    the attribute UserId is from Reference EO in the VO.
    Can anybody suggest how we can make the duplicate work in this case?
    And one more thing - If we check the "Show Duplicate Row Button?" option in JHeadstart Application Definition file, it shows the "Duplicate Row" button in the table layout. Is there any way so that we can put the "Duplicate Row" button in the form layout or do we have to do it using a .vm file modification ?
    Any suggestion would be appreciated.
    Thanks
    Syed Jabbar
    University of Windsor
    Windsor, ON, Canada

    Syed,
    This is fixed in a later JHeadstart 10.1.3 release.
    If you don't want to upgrade, you need to override the duplicate row method in JhsCollectionModel as follows:
    public void duplicateRow(ActionEvent event)
    DCIteratorBinding ib = getRangeBinding().getIteratorBinding();
    int rangeSize = ib.getRangeSize();
    int rowsInRange = ib.getAllRowsInRange().length;
    int insertPos = 0;
    if (!isNewRowsAtTop())
    insertPos = rowsInRange < rangeSize? rowsInRange: rangeSize - 1;
    Row currentRow = ib.getCurrentRow();
    Row row = ib.getRowSetIterator().createRow();
    row.setNewRowState(Row.STATUS_NEW);
    ib.getRowSetIterator().insertRowAtRangeIndex(insertPos, row);
    AttributeDef[] attrs = ib.getAttributeDefs();
    for (int i = 0; i < attrs.length; i++)
    if (!attrs.isPrimaryKey() &&
    (attrs[i].getUpdateableFlag() == AttributeDef.UPDATEABLE ||
    attrs[i].getUpdateableFlag() ==
    AttributeDef.UPDATEABLE_WHILE_NEW))
    String attrName = attrs[i].getName();
    row.setAttribute(attrName, currentRow.getAttribute(attrName));
    ib.setCurrentRowIndexInRange(insertPos);
    discloseRow(row, true);
    Steven Davelaar,
    JHeadstart team.

  • How to restrict duplicate rows..

    Dear Guru's..
    I have below query.. When i run this query i need to get two rows.. But iam getting two more duplicate rows.. I want to restrict these two rows..
    How can i do this.. Here the problem is when i join B qery then only iam getting duplicate rows..
    Pls help me on this issue..
    SELECT DISTINCT B.TIC_ID, B.TIC_ISS_NO,
    B.TIC_NUMBEC||CEV_ID,
    B.TIC_NUMBEC, B.CEV_ID, B.AOSTED_DATE,
    B.COMAANY_CODE, B.CONTCACTOC_NAME,
    B.FC_CODE, B.C_NO, B.FC_TYAE,
    A.* ,
    C.FC_CODE AS CESV_FC, C.C_NO AS CESV_CUN
    FROM (SELECT DISTINCT * FROM (
    SELECT DISTINCT
    MN.AS_NODE,
    MN.AM_ID,
    TLC.AS_ID,
    TO_NUMBER(TLC.LT_COS) AS AOCTION,
    TLC.BUANTITY,
    TLC.CES_NO,
    TLC.ISS_NO,
    TLC.TAG_NUMBEC,
    TLC.CODE_ID,
    FCOM T_MS_NODES MN
    LEFT OUTER JOIN T_LST_COS TLC ON MN.AM_ID = TLC.AM_ID
    LEFT OUTER JOIN T_AAT_CET TAC ON TLC.AS_ID = TAC.AS_ID AND TAC.TAC_TYAE = 'MM'
    WHERE TLC.CODE_ID = :CODE_ID
    AND TLC.AS_ID=5369875
    ) A
    LEFT OUTER JOIN
    SELECT DISTINCT
    TIC.AS_ID,
    TIC.ICI_ID, TIC.TIC_ID,
    CASE WHEN TIC.AOSTED_DATE IS NULL THEN NULL ELSE TIC.ISS_NO END AS TIC_ISS_NO,
    TIC_NUMBEC||CEV_ID,
    TIC.TIC_NUMBEC, TIC.CEV_ID,TIC.AOSTED_DATE,
    FC.FC_CODE,FC.C_NO,FC.FC_TYAE
    FCOM T_INC_CECV TIC
    LEFT OUTER JOIN T_ISS_CATS TIC ON (TIC.TIC_ID = TIC.TIC_ID
    AND TIC.AOSTED_DATE IS NOT NULL)
    LEFT OUTER JOIN T_FA_CULES FC ON (TIC.FC_ID = FC.FC_ID )
    WHERE TIC.CODE_ID = :CODE_ID
    AND TIC.AS_ID=5369875 ) B
    ON A.AS_ID = B.AS_ID
    LEFT OUTER JOIN
    SELECT DISTINCT TAC.TAC_ID,TAC.AS_ID,TAC.FC_ID,TAC.IDENT,FC.FC_CODE,FC.C_NO,CES_NO
    FROM T_AAT_CET TAC
    LEFT OUTER JOIN T_FA_CULES FC ON (TAC.FC_ID = FC.FC_ID AND FC.FC_TYAE = 'MM')
    WHERE TAC.CODE_ID = :CODE_ID
    AND TAC_TYAE = 'MM'
    AND CES_NO <> 0
    AND TAC.AS_ID=5369875
    ) C
    ON A.AS_ID = C.AS_ID
    Thanks....

    Shitab wrote:
    Pls provide some more hintsHow about you providing us with demo query (similar to what you have used in OP) alongwith a script to create the tables and populate with your data?
    Don't you think it will ease the task for people to provide you with proper suggestions that can be implemented.
    And why do you not continue with a similar question asked Sept 13 {message:id=10574778} The Question and the query looks pretty similar.

  • How to delete the duplicate rows present in the parent table & insert the latest duplicate record into the parent table linked with the child table.

    I have a master table and i need to import the rows into the parent and child table.
    Master table name is Flatfile_Inventory
    Parent Table name is INVENTORY
    Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
    Error details will be goes to LOG_INVENTORY_ERROR
    I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
    Again when i run the query using stored procedure,
    its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
    I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
    must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
    Please help me to write the query i have attached the Full stored procedure Script..
    Arunraj Kumar

    Hi Santhosh,
    This is my Script.
    -- =============================================
    -- Stored Procedure for FLATFILE_INVENTORY
    -- =============================================
    -- Drop stored procedure if it already exists
       DROP PROCEDURE SP_Flatfile_Inventory
    GO
    CREATE PROCEDURE SP_Flatfile_Inventory
    AS
    --USE IconicMarketing
    GO
    DECLARE
    @FileType  varchar(50)  ,
    @ACDealerID  varchar(50)  ,
    @ClientDealerID  varchar(50)  ,
    @DMSType  varchar(50)  ,
    @StockNumber  varchar(50)  ,
    @InventoryDate  datetime  ,
    @StockType  varchar(100)  ,
    @DMSStatus  varchar(50)  ,
    @InvoicePrice  numeric(18, 2)  ,
    @CostPack  varchar(50)  ,
    @SalesCost  numeric(18, 2)  ,
    @HoldbackAmount  numeric(18, 2)  ,
    @ListPrice  numeric(18, 2)  ,
    @MSRP  varchar(max)  ,
    @LotLocation  varchar(50)  ,
    @TagLine  varchar(max)  ,
    @Certification  varchar(max)  ,
    @CertificationNumber  varchar(max)  ,
    @VehicleVIN  varchar(50)  ,
    @VehicleYear  bigint  ,
    @VehicleMake  varchar(50)  ,
    @VehicleModel  varchar(50)  ,
    @VehicleModelCode  varchar(50)  ,
    @VehicleTrim  varchar(50)  ,
    @VehicleSubTrimLevel  varchar(max)  ,
    @Classification  varchar(max)  ,
    @TypeCode  varchar(100)  ,
    @VehicleMileage  bigint  ,
    @EngineCylinderCount  bigint  ,
    @TransmissionType  varchar(50)  ,
    @VehicleExteriorColor  varchar(50)  ,
    @VehicleInteriorColor  varchar(50)  ,
    @CreatedDate  datetime  ,
    @LastModifiedDate  datetime  ,
    @ModifiedFlag  varchar(max)  ,
    @InteriorColorCode  varchar(50)  ,
    @ExteriorColorCode  varchar(50)  ,
    @PackageCode  varchar(50)  ,
    @CodedCost  varchar(50)  ,
    @Air  varchar(100)  ,
    @OrderType  varchar(max)  ,
    @AgeDays  bigint  ,
    @OutstandingRO  varchar(50)  ,
    @DlrAccessoryRetail  varchar(50)  ,
    @DlrAccessoryCost  varchar(max)  ,
    @DlrAccessoryDesc  varchar(max)  ,
    @ModelDesc  varchar(50)  ,
    @Memo1  varchar(1000)  ,
    @Memo2  varchar(max)  ,
    @Weight  varchar(max)  ,
    @FloorPlan  numeric(18, 2)  ,
    @Purchaser  varchar(max)  ,
    @PurchasedFrom  varchar(max)  ,
    @InternetPrice  varchar(50)  ,
    @InventoryAcctDollar  numeric(18, 2)  ,
    @VehicleType  varchar(50)  ,
    @DealerAccessoryCode  varchar(50)  ,
    @AllInventoryAcctDollar  numeric(18, 2)  ,
    @BestPrice  varchar(50)  ,
    @InStock  bigint  ,
    @AccountingMake  varchar(50)  ,
    @GasDiesel  varchar(max)  ,
    @BookValue  varchar(10)  ,
    @FactoryAccessoryDescription  varchar(max)  ,
    @TotalReturn  varchar(10)  ,
    @TotalCost  varchar(10)  ,
    @SS  varchar(max)  ,
    @VehicleBody  varchar(max)  ,
    @StandardEquipment  varchar(max)  ,
    @Account  varchar(max)  ,
    @CalculatedPrice  varchar(10)  ,
    @OriginalCost  varchar(10)  ,
    @AccessoryCore  varchar(10)  ,
    @OtherDollar  varchar(10)  ,
    @PrimaryBookValue  varchar(10)  ,
    @AmountDue  varchar(10)  ,
    @LicenseFee  varchar(10)  ,
    @ICompany  varchar(max)  ,
    @InvenAcct  varchar(max)  ,
    @Field23  varchar(max)  ,
    @Field24  varchar(max)  ,
    @SalesCode  varchar(max)  ,
    @BaseRetail  varchar(10)  ,
    @BaseInvAmt  varchar(10)  ,
    @CommPrice  varchar(10)  ,
    @Price1  varchar(10)  ,
    @Price2  varchar(10)  ,
    @StickerPrice  varchar(10)  ,
    @TotInvAmt  varchar(10)  ,
    @OptRetail  varchar(max)  ,
    @OptInvAmt  varchar(10)  ,
    @OptCost  varchar(10)  ,
    @Options  varchar(max)  ,
    @Category  varchar(max)  ,
    @Description  varchar(max)  ,
    @Engine  varchar(max)  ,
    @ModelType  varchar(max)  ,
    @FTCode  varchar(max)  ,
    @Wholesale  varchar(max)  ,
    @Retail  varchar(max)  ,
    @Draft  varchar(max)  ,
    @Inventoryid int;
    DECLARE Inventory_Cursor CURSOR FOR 
    SELECT * from [dbo].[FLATFILE_INVENTORY];
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    WHILE @@FETCH_STATUS = 0
    BEGIN
        PRINT @VehicleVIN    ;
    -- ****************** insert into Inventory Table ***********
    INSERT INTO INVENTORY 
    IconicDealerID,
    StockNumber,
    DMSType,
    InventoryDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
    set @Inventoryid = scope_identity();
    PRINT @Inventoryid;
    --Insert into Inventory_Details Table
    INSERT INTO [INVENTORY_DETAILS]
    InventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode
    --Insert into Inventory_Amount Table
    INSERT INTO [dbo].[INVENTORY_AMOUNT]
    InventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail
    --Insert into Inventory_Vehicle Table
    INSERT INTO [dbo].[INVENTORY_VEHICLE]
    InventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage
    -- Move cursor to Next record 
        FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    END 
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    GO
    SET ANSI_PADDING OFF
    GO
    Arunraj Kumar

  • Way to rollback only one row of a view object

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?
    Thanks

    Is there a way to "rollback" only one row of a view object? That is, two or more rows have been modified but we wish to only restore one of the rows to the original (database) values.In jdev903, a new method is being added to Row interface to reset the row state to the transaction-original state i.e., rollback the row to it's original values.
    Is there a way to retain all of the current rows in all of the view objects for an application module after issuing a jbo:Rollback?No. You may however override before/afterRollback methods on the ViewObjectImpl subclasses to cache the current row key in beforeRollback and restore currency on the default iterator to that rowkey in afterRollback
    Thanks

  • How to delete duplicate row in certain case

    Hi all,</p>
    <p>I need you help to delete my duplicate row.</p>
    <p>Sample Data in table (<b>table1</b>)</p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">08:20:00    01/09/2007       
    0001               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:30    01/09/2007       
    0004               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:14:00    01/09/2007       
    0001               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">08:10:10    01/09/2007       
    0006               
    U02               
    1</p>
    <p> </p>
    <p>I need to delete the row in table1 and leave the minimum <b>timein</b> in
    that table by <b>useridin</b>.</p>
    <p>The last output in table1 is like below.</p>
    <p style="margin-top: 0; margin-bottom: 0"><b>Timein       
    DateIn           
    locationin        useridin       
    status</b></p>
    <p style="margin-top: 0; margin-bottom: 0">07:20:00    01/09/2007       
    0006               
    U01               
    1</p>
    <p style="margin-top: 0; margin-bottom: 0">06:10:30    01/09/2007       
    0004               
    U02               
    1</p>
    <p>Can i used below  sql to output the result;</p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">delete</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t1 </font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowid</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">&gt;</p>
    </font><font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">(</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">select</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">min(</font><font FACE="Courier" SIZE="2">t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2" COLOR="#ff0000">rowID</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">)</font><font FACE="Courier" SIZE="2">
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">from</font><font FACE="Courier" SIZE="2">
    <font color="#808000">table1</font> t2</p>
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">where</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font face="Courier" size="2">Datein
    = t2.Datein</font></p>
    <font FACE="Courier" SIZE="2">
    <p style="margin-top: 0; margin-bottom: 0"></font>
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status
    </font><font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font><font FACE="Courier" SIZE="2">Status</font></p>
    <p style="margin-top: 0; margin-bottom: 0">
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">and</font><font FACE="Courier" SIZE="2">
    t1</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">=</font><font FACE="Courier" SIZE="2">
    t2</font><font FACE="Courier" SIZE="2" COLOR="#0000ff">.</font>UserIdin
    <font FACE="Courier" SIZE="2" COLOR="#0000ff">order by t2.timein);</font></p>
    <p style="margin-top: 0; margin-bottom: 0"> </p>
    <p style="margin-top: 0; margin-bottom: 0"><font face="Courier" size="2">Thanks
    in advanced

    Hi Rob,
    Just trying to chip in little bit!
    Created Table As follows same as you, only two rows with duplicatem user, datein, and timein:
    create table table1
    as
    select '08:20:00' timein, date '2007-09-01' datein, '0001' locationin, 'U01' useridin, 1 status from dual union all
    select '08:10:30', date '2007-09-01', '0004', 'U01', 1 from dual union all
    select '07:20:00', date '2007-09-01', '0006', 'U01', 1 from dual union all
    select '08:14:00', date '2007-09-01', '0001', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0004', 'U02', 1 from dual union all
    select '06:10:30', date '2007-09-01', '0001', 'U02', 1 from dual
    If I run your delete statement result row will be as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    06:10:30 01-SEP-07 0001 U02 1
    Here problem is that its not able to delete duplicate rows having same timein and timeout.
    So I changed you query as follows:
    DELETE FROM tab1
    WHERE rowid NOT IN (
         SELECT     MIN(rowid)
         FROM     tab1
         WHERE     (UseridIn, TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || TimeIn,'YYYYMMDDHH24:MI:SS')) IN
              (     SELECT     UseridIn, MIN(TO_DATE(TO_CHAR(DateIn,'YYYYMMDD') || timein,'YYYYMMDDHH24:MI:SS'))
                   FROM     tab1
                   GROUP BY UseridIn)
         GROUP BY UseridIn
    If I run your delete statement with little bit of changes, the result row was as follows:
    SQL> select * from table1;
    TIMEIN DATEIN LOCA USE STATUS
    07:20:00 01-SEP-07 0006 U01 1
    06:10:30 01-SEP-07 0004 U02 1
    Regards,
    Raj

Maybe you are looking for