Obtaining duplicate values.

Hi all

I have a table with collums as follows:
create table uni_ids 
(ID varchar2(10),
 field number,
 activity number,
 frequence number,
 field_1 number,
 field_2 varchar(100));
and the following data:
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1999',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1999',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1990',1,3,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1990',1,4,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1990',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1991',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1991',1,3,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1991',1,3,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1992',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1997',1,2,600,15,'SOME TEXT');
 insert into uni_ids (ID,field,activity,frequence,field_1,field_2) values('N1995',1,8,600,15,'SOME TEXT');
What I would get with my querry is duplicated files, so resoul of it should be like:
ID               field     activity     frequence          field_1               field_2
N1999          1          2               600                    15                    SOME TEXT
N1999          1          2               600                    15                    SOME TEXT
N1991          1          3               600                    15                    SOME TEXT
N1991          1          3               600                    15                    SOME TEXT
Insofar as that I came up with this SQL that does not work as it should. It returns the other (do not duplicate) values as well...
select

    a.id,
    a.field,
    a.activity,
    a.frequence,
    a.field_1,
    a.field_2
    
from uni_ids a

where a.rowid <> (
select 
  max(b.rowid)
from  uni_ids b
where a.id= b.id 
      and a.field = b.field 
      and a.activity = b.activity)

ORDER BY a.id;
If anyone can help please post solution

Thank you!

Select
a.ID,
a.Field,
a.Activity,
a.FREQUENCE,
a.Field_1,
a.Field_2
of uni_ids one
where
(id, domain, activity, frequency, Champ_1, Champ_2) in
(select id
field
activity
frequency
Champ_1
Champ_2
of uni_ids
Group by domain, activity, frequency, Champ_1, id, Champ_2
having count (*) > 1);

Tags: Database

Similar Questions

  • Query generates duplicate values in successive lines. I can null out them?

    I have had very good success (thanks to Andy) to obtain detailed responses to my questions posted, and I wonder if there is a way in a region report join query that produces lines with duplicate values, I cannot suppress (replace) printing of duplicate values in successive lines. In the event that I managed to turn the question into a mess unintelligible (one of my specialities), let me give an example:

    We try institutions undergraduate that an applicant has participated in the list and display information on release dates, gpa and major (s) / according to decision-making. The problem is that there may be several major (s) / minor (s) for a given undergraduate institution, so the following is produced by the query:

    Knox College hard 01/02 01/06 4,00 knitting
    Knox College hard 01/02 01/06 4,00 cloth repair
    Advanced University 02/06 01/08 3.75 Clothing Design
    Really advanced U 02/08 01/09 4,00 sportswear
    Really advanced U 02/08 01/09 4,00 basketball burlap

    I want it to look like this:

    Knox College hard 01/02 01/06 4,00 knitting
    Tissue repair
    Advanced University 02/06 01/08 3.75 Clothing Design
    Really advanced U 02/08 01/09 4,00 sportswear
    Burlap tennis shoe

    * (Edit) Please note that the repair of fabric and lines tennis shoe repair should be positioned properly in a table, but unfortunately had space here for a reason suppresed any. *

    Under the tuteage of Andy, I would say the answer is probably javascript one loop in the DOM, you are looking for the innerHTML of specific TDs in the table, but I want to confirm that, or Apex provides it a box I can check which will produce the same results? Thanks to the guy to advance and sorry for all the questions. We were charged to use Apex for our next project and learn it using it, as the training budget is non-existent this year. I love ;) unfunded mandates

    Phil

    Published by: Phil McDermott on August 13, 2009 09:34

    Hi Phil,

    JavaScript is useful, because the feature break column in the report attributes (which would be my first choice if poss).

    If you need to go beyond 3 columns, I would say something in the SQL statement itself. This means that the sort would probably have to be controlled, but it is doable.

    This is a pretty old thread on the subject: Re: grouping reports (non-interactive) -with an example here: [http://htmldb.oracle.com/pls/otn/f?p=33642:112] (I used a custom template for the report, but you don't need to go that far!)

    This uses the features of LAG in SQL to compare the values on line for values on the line before - ability to compare these values allows you to determine which ones to show or hide.

    Andy

  • How to find duplicates of a field value? For example - in a field, I have values like {123,345,346,123}, now I want to remove the duplicate value in the field so that my output looks like {123,345,346}

    How to find duplicates of a field value? For example - in a field, I have values like {123,345,346,123}, now I want to remove the duplicate value in the field so that my output looks like {123,345,346}

    If it's an array you want to deduplicate then here is a script [for use in the Script Processor] I prepared earlier:

    var result = new Array();

    var added = new Object();

    If (input1 [0]! = null)

    {

    for (var i = 0; i)< input1[0].length;="">

    {

    var point = input1 [0] [i];

    If (! added [item])

    {

    added [item] = 1;

    result [result. Length] = item;

    }

    }

    }

    Output 1 = result;

    Kind regards

    Nick

  • Duplicate values generated by an Oracle sequence

    Hello

    Since a few days we are facing a weird problem in our application where the sequences seem to be generating duplicate values. Previously I thought is this is not possible, but now it seems to be a problem. Here are the details:

    Select * from v$ version;

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    PL/SQL Release 11.2.0.2.0 - Production

    CORE Production 11.2.0.2.0

    AMT for Linux: Version 11.2.0.2.0 - Production

    NLSRTL Version 11.2.0.2.0 - Production

    We use to insert it into a table column of the last sequence value that is of course the primary key of the table column. Today, we received a violation of unique constraint on the column of the primary key (which is driven by the sequence). Below is the last value of the PK column

    SELECT MAX(PCCURVEDETAILID) OF T_PC_CURVE_DETAILS;

    162636

    and below, was the last value in the sequence that has been less than the PK column

    SELECT S_PCCURVEDETAILS. NEXTVAL FROM DUAL;

    162631

    Then we checked the data of the user_sequences and found the next sequence value (LAST_NUMBER) to be 162645 which was greater than the current value of the sequence:

    Select * de user_sequences one a.sequence_name as "S_PCCURVEDETAILS" ;

    SEQUENCE_NAME

    MIN_VALUE

    MAX_VALUE

    INCREMENT_BY

    CYCLE_FLAG

    ORDER_FLAG

    CACHE_SIZE

    LAST_NUMBER

    S_PCCURVEDETAILS

    1

    1E + 27

    1

    N

    N

    20

    162645

    I then modified the nocache sequence:

    change sequence S_PCCURVEDETAILS NoCache ;

    Select * de user_sequences one a.sequence_name as "S_PCCURVEDETAILS" ;

    SEQUENCE_NAME

    MIN_VALUE

    MAX_VALUE

    INCREMENT_BY

    CYCLE_FLAG

    ORDER_FLAG

    CACHE_SIZE

    LAST_NUMBER

    S_PCCURVEDETAILS

    1

    1E + 27

    1

    N

    N

    0

    162633

    SELECT S_PCCURVEDETAILS. NEXTVAL FROM DUAL;

    162632

    We also face the same type of problem of violation of primary key to another sequence-driven table, a few days before.

    In our code, I also checked that the primary key in the table value is inserted using only the value of the sequence.

    Can anyone please suggest any reason this issue for

    Concerning

    Deepak

    I faced a similar problem about 3 years ago. Here's the story, suddenly in my UAT environment a job that inserts data in some tables began to throw exceptions of primary key violation. After investigation, I found that the sequence is x, but the primary key for the table is x + y. investigation more - DBA moved all production data without even notifying the application support team.

    Morale - pretty obvious

  • Check all the duplicate values in the column COUNT()

    Hello

    I'll do some tests, and for this I need to retrieve data based on a single column for example test_data_col, which-
    1 to 3 or more count (test_data_col) for a given set of columns for example grp_col1, grp_col2, grp_col3 group
    2. overall recovered lines, this particular column has some duplicate values. I don't need displayed duplicates, just whether or not duplicates exist.

    Which could explain what I'm trying to do -

    grp_col1, grp_col2, grp_col3, test_data_col

    1, A, xyz, HELLO
    1, A, xyz, HELLO
    1, a, xyz, BYE
    1, A, xyz, goodbye

    2, C, pqr, WELCOME
    2, C, pqr, GOOD MORNING
    2, C, pqr, BAD MORNING

    So for condition 1, I do something like that.
    SELECT COUNT(test_data_col) cnt, grp_col_1, grp_col2, grp_col3
    FROM test_tab
    GROUP BY grp_col_1, grp_col2, grp_col3
    HAVING COUNT(test_data_col) >= 3;
    In this request, I want to do something that will tell me if the aggregate COUNT (test_data_col) has all the duplicate values it contains. Yet once, display the duplicates is not important here.
    SELECT COUNT(test_data_col) cnt, grp_col_1, grp_col2, grp_col3,
    /*some logic*/ dup_val
    FROM test_tab
    GROUP BY grp_col_1, grp_col2, grp_col3
    HAVING COUNT(test_data_col) >= 3;
    With the correct to replace coding / * some * logic /, I have following values.

    CNT, grp_col_1, grp_col2, grp_col3, dup_val

    4, 1, a, xyz, Y
    3, 2, C, pqr, N

    I have dup_val column to explain what I'm trying to achieve... Another way to know the existence of duplicates in the aggregate count will be fine.

    My version of Oracle's Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0

    Do you like the answer!

    Your somewhere logical can be like that

    case when COUNT(test_data_col) != COUNT(distinct test_data_col) the 'Y' else 'N' end dup_val
    
  • Returns all the duplicate values in object lookup (PHP, drop-down list)

    Hi, I have a PHP page I designed as a search page. I have a number of drop-down lists that get their dynamic values from the fields in a MySQL database.

    At present, if there are any entries that have duplicate values in a certain area, they are all listed, in the order of the index database. For example:

    City:

    Derby

    Stoke

    Stafford

    Stoke

    Derby

    Derby

    Stoke

    etc...

    Now, I want to do is be able to show all results for a given city. In the find what drop-down list box, I would than each of the cities to appear only once rather than every time it is registered. included in this, I would like the page of results to then display ALL results that match this search criteria.

    Thus, in the example above, "Derby" appears only once, but when the user has selected 'Derby', it would return all three results in the results page.

    My results page is built on a dynamic form, so I am confident that the results page would make it according to the needs. However, how can I get the drop-down list box to ask him?

    > 'SELECT DISTINCT table1.champ1, table1.champ2, table1.champ3 FROM Table1 ";

    Duplicate rows to remove the DISTINCT keyword strength SQL. In other words, that it will only return the unique combinations of fields in your selection list. If you examine your results set, you will see that each line is separate, although there may be duplicates in a particular area. Because you want to populate a drop-down list, you must include a field in your select list only, otherwise you get of the dupes.

  • Customize alert messages to check the duplicate value and alert success

    Hi all

    I want to show two alert against the button 'Submit' even at -.

    1 the attention of messages to check the duplicate value and show the duplicate value found alert and
    2 alert if successful the form's success to commit no duplicate values found.

    I did all the thing but what alert-1 show and I pressed the ok button of the alert, then the second alert also shows that I don't want to show.

    Who can I do about it? Have someone to help me!

    Arif

    Use the folliwng in PRE-INSERT-TRIGGER.

    There is not a lot of changes with the exception

    where CANCELLATION_USERID =: CANCELLATION_USERID;

    and

    If valExists > 0 then

    declare
    
     valExists number;
    
    begin
    
     select count(*) into valExists
     from USERDELETION
     where CANCELLATION_USERID = to_char(:CANCELLATION_USERID);
    
     if valExists > 0 then
      message('Duplicate value found !');
      -- show_alert('ERROR_ALERT');
     else
      message('All is well');
      -- show_alert('All is well ');
     end if;
    
    end;
    
  • Select duplicate values

    Hi guys of


    How can I select only the duplicate values in a column? upward on the selection I'll be removing duplicates



    Thank you

    REDA

    Hi reda,.

    delete from table_name
          where rowid not in (  select min(rowid)
                                  from table_name
                              group by column_name);
    

    Concerning
    Peter

  • EL for obtaining a value of selected line

    Hello experts!

    I have a page with a table of users and I implement a button named "Reset the user password".

    I want to display a popup with a title: "reset password for user: xxxx", where xxx is to be obtained by EL referring to the current user selected in the users table.

    Any idea? I use jdev 12.1.2

    Thank you!

    I found the solution in the book Jobinesh-Oracle that I bought a long time ago! (Thanks!)

    Declaratively reading the value of the attribute of the currently selected line

    It is very common that when a line is selected in a table, you can update

    other fields in the user interface or call some specific operations with attributes of the selected

    line. There is an easy way to retrieve the attributes you want for the current of line

    definition of the attribute for the attribute binding.

    To set the attribute binding, do the following:

    1. double-click on the file page definition to open the presentation Editor.

    Alternatively, if you have the JSF page opened in the designer

    window, and then by selecting the links tab will open the corresponding

    page definition file editor.

    2. Select the links and the executable tab and click the Green plus icon to

    create a control's binding icon that will be displayed on the bindings panel.

    3. in the dialog window insert an element, select the generic category of links (if it)

    is not selected by default) in the menu drop down and select attribute values

    as the point to be created. Click OK to proceed to the next step. In the

    Create the attribute Binding dialog box, select the desired data source

    (instance of the view object) and then the attribute you want to read

    the line selected in the data source. Click OK to have the dialog box.

    The following is an example for a binding attribute value defined by choosing the

    Collection Departments as data source:

    It's in the page definition XML file

    ID = "DepartmentName" >

    Once you have defined the attribute bindings, you can refer to them using the

    EL of the client binding expression. For example, the value of the previous attribute

    reference can be made using the expression of ADF link as follows:

    #{bindings. DepartmentName.inputValue}

  • Duplicate values in the union

    Hello

    I am change the below query, the results that are returned contain duplicates.

    For example the 'Customer' column contains the value "GBI-FELIX" 5 times.

    I had a glance through the SQL and can not see any because of that. Can you see the problem?

    select
    to_char(sysdate, 'DD-Mon-YYYY HH24:MI:SS'),
    ol.client_id client,
    trunc(oh.ship_by_date) shipdate,
    nvl(sum(ol.qty_ordered),0) as orig_ord,
    nvl(sum(ol.qty_shipped),0) as shipped,
    nvl(sum(sm.smpicked),0) as unshipped,
    nvl(sum(held.qty_to_move),0) as held,
    nvl(sum(rel.qty_to_move),0) as reld,
    nvl(sum(mar.qty_to_move),0) as marsh,
    sum(ol.qty_ordered - (nvl(ol.qty_tasked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(sm.smpicked),0) as unalloc,
    sum(ol.qty_ordered -(nvl(sm.smpicked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(mar.qty_to_move),0) as topick
    
    from    order_line ol,
            order_header oh,
         
            (select sum(qty_picked) as smpicked,
            client_id, order_id, line_id 
            from shipping_manifest
            where shipped != 'Y'
            group by client_id, order_id, line_id) sm,
            
         (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
         where task_type = 'O'
         and status != 'Consol'
         and status!= 'Released'
         and status!= 'In Progress'
         group by task_id, client_id, line_id) held,
            
         (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Hold'
            group by task_id, client_id, line_id) rel,
            
         (select sum(qty_to_move) qty_to_move,
         task_id, client_id, line_id 
            from move_task
         where task_type = 'O'
         and status = 'Consol'
         group by task_id, client_id, line_id) mar
      
    where ol.client_id = oh.client_id
    and ol.order_id = oh.order_id
    and ol.order_id = sm.order_id (+)
    and ol.client_id = sm.client_id (+)
    and ol.line_id = sm.line_id (+)
    and trunc(oh.ship_by_date) = $P{ship_by_date}
    and ol.order_id = held.task_id (+)
    and ol.client_id = held.client_id (+)
    and ol.line_id = held.line_id (+)
    and ol.order_id = rel.task_id (+)
    and ol.client_id = rel.client_id (+)
    and ol.line_id = rel.line_id (+)
    and ol.order_id = mar.task_id (+)
    and ol.client_id = mar.client_id (+)
    and ol.line_id = mar.line_id (+)
    and ol.sku_id not in (select sku_id
                      from sku
                      where product_group = 'WIP')
    and oh.consignment not like 'DAIRN%'
    and oh.client_id != 'DAIRNUNEAT'
    group by ol.client_id, ship_by_date
    
                                             UNION
    
    select
    to_char(sysdate, 'DD-Mon-YYYY HH24:MI:SS'),
    (select 'Total' from dual) client,
    trunc(oh.ship_by_date) shipdate,
    nvl(sum(ol.qty_ordered),0) as orig_ord,
    nvl(sum(ol.qty_shipped),0) as shipped,
    nvl(sum(sm.smpicked),0) as unshipped,
    nvl(sum(held.qty_to_move),0) as held,
    nvl(sum(rel.qty_to_move),0) as reld,
    nvl(sum(mar.qty_to_move),0) as marsh,
    sum(ol.qty_ordered - (nvl(ol.qty_tasked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(sm.smpicked),0) as unalloc,
    sum(ol.qty_ordered - (nvl(sm.smpicked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(mar.qty_to_move),0) as topick
    
    from    order_line ol,
            order_header oh,
            
            (select sum(qty_picked) as smpicked,
            client_id, order_id, line_id 
            from shipping_manifest
            where shipped != 'Y'
            group by client_id, order_id, line_id) sm,
            
         (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Released'
            and status != 'In Progress'
            group by task_id, client_id, line_id) held,
      
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Hold'
            group by task_id, client_id, line_id) rel,
      
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status = 'Consol'
            group by task_id, client_id, line_id) mar
      
    where ol.client_id = oh.client_id
    and ol.order_id = oh.order_id
    and ol.order_id = sm.order_id (+)
    and ol.client_id = sm.client_id (+)
    and ol.line_id = sm.line_id (+)
    and ol.order_id = held.task_id (+)
    and ol.client_id = held.client_id (+)
    and ol.line_id = held.line_id (+)
    and ol.order_id = rel.task_id (+)
    and ol.client_id = rel.client_id (+)
    and ol.line_id = mar.line_id (+)
    and ol.order_id = mar.task_id (+)
    and ol.client_id = mar.client_id (+)
    and ol.line_id = rel.line_id (+)
    and ol.sku_id not in (select sku_id
                      from sku
                      where product_group = 'WIP')
    and oh.consignment not like 'DAIRN%'
    and trunc(oh.ship_by_date) = $P{ship_by_date}
    group by ship_by_date
    
                                                   UNION
                                                   
    select
    to_char(sysdate, 'DD-Mon-YYYY HH24:MI:SS'),
    (select '1FORZA WIP        ' from dual) client,
    trunc(oh.ship_by_date) shipdate,
    nvl(sum(ol.qty_ordered),0) as orig_ord,
    nvl(sum(ol.qty_shipped),0) as shipped,
    nvl(sum(sm.smpicked),0) as unshipped,
    nvl(sum(held.qty_to_move),0) as held,
    nvl(sum(rel.qty_to_move),0) as reld,
    nvl(sum(mar.qty_to_move),0) as marsh,
    sum(ol.qty_ordered - (nvl(ol.qty_tasked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(sm.smpicked),0) as unalloc,
    sum(ol.qty_ordered - (nvl(sm.smpicked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(mar.qty_to_move),0) as topick
    
    from    order_line ol,
            order_header oh,
    
            (select sum(qty_picked) as smpicked,
            client_id, order_id, line_id 
            from shipping_manifest
            where shipped != 'Y'
            group by client_id, order_id, line_id) sm,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Released'
            and status != 'In Progress'
            group by task_id, client_id, line_id) held,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Hold'
            group by task_id, client_id, line_id) rel,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status = 'Consol'
            group by task_id, client_id, line_id) mar
            
    where ol.client_id = oh.client_id
    and ol.order_id = oh.order_id
    and ol.order_id = sm.order_id (+)
    and ol.client_id = sm.client_id (+)
    and ol.line_id = sm.line_id (+)
    and ol.order_id = held.task_id (+)
    and ol.client_id = held.client_id (+)
    and ol.line_id = held.line_id (+)
    and ol.order_id = rel.task_id (+)
    and ol.client_id = rel.client_id (+)
    and ol.line_id = mar.line_id (+)
    and ol.order_id = mar.task_id (+)
    and ol.client_id = mar.client_id (+)
    and ol.line_id = rel.line_id (+)
    and trunc(oh.ship_by_date) = $P{ship_by_date}
    and ol.sku_id in (select sku_id
                      from sku
                      where product_group = 'WIP')
    group by ship_by_date
    
                                                   UNION
                                                   
    select
    to_char(sysdate, 'DD-Mon-YYYY HH24:MI:SS'),
    (select 'DAIRNUNEAT' from dual) client,
    trunc(oh.ship_by_date) shipdate,
    nvl(sum(ol.qty_ordered),0) as orig_ord,
    nvl(sum(ol.qty_shipped),0) as shipped,
    nvl(sum(sm.smpicked),0) as unshipped,
    nvl(sum(held.qty_to_move),0) as held,
    nvl(sum(rel.qty_to_move),0) as reld,
    nvl(sum(mar.qty_to_move),0) as marsh,
    sum(ol.qty_ordered - (nvl(ol.qty_tasked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(sm.smpicked),0) as unalloc,
    sum(ol.qty_ordered - (nvl(sm.smpicked,0) + nvl(ol.qty_shipped,0))) - nvl(sum(mar.qty_to_move),0) as topick
    
    from    order_line ol,
            order_header oh,
    
            (select sum(qty_picked) as smpicked,
            client_id, order_id, line_id 
            from shipping_manifest
            where shipped != 'Y'
            group by client_id, order_id, line_id) sm,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Released'
            and status != 'In Progress'
            group by task_id, client_id, line_id) held,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status != 'Consol'
            and status != 'Hold'
            group by task_id, client_id, line_id) rel,
            
            (select sum(qty_to_move) qty_to_move,
            task_id, client_id, line_id 
            from move_task
            where task_type = 'O'
            and status = 'Consol'
            group by task_id, client_id, line_id) mar
            
    where ol.client_id = oh.client_id
    and ol.order_id = oh.order_id
    and ol.order_id = sm.order_id (+)
    and ol.client_id = sm.client_id (+)
    and ol.line_id = sm.line_id (+)
    and ol.order_id = held.task_id (+)
    and ol.client_id = held.client_id (+)
    and ol.line_id = held.line_id (+)
    and ol.order_id = rel.task_id (+)
    and ol.client_id = rel.client_id (+)
    and ol.line_id = mar.line_id (+)
    and ol.order_id = mar.task_id (+)
    and ol.client_id = mar.client_id (+)
    and ol.line_id = rel.line_id (+)
    and trunc(oh.ship_by_date) = $P{ship_by_date}
    and oh.consignment like 'DAIRN%'
    group by ship_by_date
    Kind regards

    Sam.

    What block of union query results in duplicate is the first, 2nd, third or fourth? If you do not try running each query and see if you can find them.

  • ORA-00001 on form insert, duplicate value

    Hello!
    I have 8 fields in my form. The values of 4 of them go in Table1 and Table2 others 4.
    Table 1 has a composite unique constraint based on 2 columns (which are filled with the first 2 fields in my form which are the first and last name).
    Table2 has no constraints.
    I've manually recreated my form that was originally made with the wizard block/layout of data. So now im integration with applications I've written. I have to mention everything works fine as long as im not looking to insert a record for someone who is already in Table1.

    The problem: ORA-00001 ("you tried to execute an INSERT or UPDATE statement that created a value duplicated in an area limited by a single index.") when im trying to insert a record for someone who is already in the table 1 (i.e. the name and family name combination is most unique in Table1). In Table1, I say everything is all right, because I don't want to not more than once the same person, but because of this exception ORA INSERT into Table2 also fails. How can I avoid this?

    The code is also just that INSERT INTO can get so I won't post.

    THX,
    Iulian

    If I understand the problem correctly from what you say,

    "So now im integration with applications I've written. The code is also just that INSERT INTO can get so I won't post. »

    This means that you have two table insert statements. Wrap the first statement with the Manager of exceptions as noted below. This way nothing will be inserted into table1 when there are duplicate, but you can insert into another table.

    Begin
    Begin
    Insert into table1 values...
    Exception when DUP_VAL_ON_INDEX then
    Null;
    End;
    Insert into table2 values...

    End;

    I hope this works.

  • How to insert duplicate values in another table.

    angle of attack!
    I created two tables a and b

    create table one
    (key primary code number);

    create table b
    (code number,
    DAT date);

    insert into the table of a (code)
    values (1234);
    insert into the table of a (code)
    values (1235);
    commit;
    Select * from a;
    one
    -----
    1234
    1235
    -----
    insert into the table of a (code)
    values (1234);
    commit;
    ERROR on line 1:
    ORA-00001: unique constraint (GMS. SYS_C0030897) violated

    {color: #ff0000} * I need, when the user inserts duplicate data, must be inserted into another table b.* {color}

    How can I do in forms 6i? Help, please. Thanks in advance.

    Hello

    What is the relationship with the forms?

    Anyway, you can create a trigger on table A that intercepts the error in an exception block, and then create a new row in table B.
    If the error comes from a forms based block, intercept the error in a trigger insert.

    François

  • Event just after obtaining return value of lov inline search page

    Hi all

    I created a lov inline search, my page looks like this:

    page.png

    When I search and select the result I want.

    page1.png

    I get this result selected as back to my point of return of my page:

    page 3.png

    What I want is:

    At the time when the page is displayed to show me the value selected, I want to show him something else on this return value. For this I need to know what the event or the setting I need to take to whether or not the selection is made.

    I hope I made clear what I need

    Thank you very much for your help

    Kind regards

    Afaf

    Not really sure what you are after. You can try this.

    If (PageContext.isLovEvent ())

    {

    String lovInputSourceId = pageContext.getParameter (SOURCE_PARAM);

    If ("".equals (lovInputSourceId))

    {

    }

    }

    See you soon

    AJ

  • How to validate duplicate values in application PLM GTIN

    I'm new to PLM application. Please let me know mentioned below these questions.

    1. I need to validate GTIN number dupilcate value of Oracle database.

    2. once save the GTIN number in the summary of trade specification.while insertion of the value tab, it must validate only single value if not display the error message.

    3. where do I need to write the code and the file that is to write the code? If there is no example

    Thank you

    Floquet

    Ron Awesom...

    Its working fine... Thanks much for your support very much and I'm new to this PLM Oracle agile. This is the first time enter and I learned a lot of things. Because of you...

    Thanks again for your support...

  • Obtaining the value zero

    Hi all

    I extend the standard page controller

    I try to capture the value of an element on the page, but I get the value zero.

    Here are the syntaxes I tried

    String s = oapagecontext.getParameter ("EmployeeNumber");

    and

    String s = (String) oapagecontext.getSessionValue ("EmployeeNumber");

    Please suggest me.

    Kind regards

    Sangu

    It does not work like that,

    There are two ways to get the value of the entire area of text in code and also depends on in what method (processRequest or processFormRequest) you want to capture the values.

    Method 1: -.

    OAMessageTextInputBean employeeNumberBean = (OAMessageTextInputBean) webBean.findChildRecursive ("EmployeeNumber"); assuming that the id of the TextField is EmployeeNumber

    String EmployeeNumber = employeeNumberBean.getValue (pageContext) m:System.NET.SocketAddress.ToString ();

    or the best way is to always get with the original Version instead of the bean - here is the code to browse the vo, you just have to identify the vo that is attached to the input area and where your employeeNumber is present and replace this vo name in the code below

    BankAccountsVOImpl BankAccountsVO = (BankAccountsVOImpl) am.findViewObject ("BankAccountsVO");

    Line BankAccountsVORowImpl = null;

    int fetchedRowCount = BankAccountsVO.getFetchedRowCount ();

    RowSetIterator rowIterator = BankAccountsVO.createRowSetIterator ("iteraTor");

    If (fetchedRowCount > 0)

    {

    rowIterator.setRangeStart (0);

    rowIterator.setRangeSize (fetchedRowCount);

    for (int count = 0; count)< fetchedrowcount="" ;="" count++) ="">

    line = (BankAccountsVORowImpl) rowIterator.getRowAtRangeIndex (count);

    entity = row.getAttribute1 ();    -instead of this line, here you can write to row.getEmployeeNumber if it is an attribute of the vo

    majorOffice = row.getAttribute2 ();

    Office = row.getAttribute3 ();

    }

    }

    rowIterator.closeRowSetIterator ();

    Thank you

    Hemant

Maybe you are looking for