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

Tags: Database

Similar Questions

  • 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

  • When I'm signed Windows Live, my screen shows two lines and when I type my name and password I can't see them.

    When I sign live Windows my screen only showed when I type my name and passoword and lines I can't see them, and yet it opens to my email. What happens and how can I fix.  Also on some Microsoft sites, I can also not read the page it is blanck and only a few show blue lines but no words. Help I know not if I maybe downloaded somethng but need to read websites and I can't.  I went on the essential Microsoft website to download and I can see a picture but no words.

    Hi Marlene,

    The best place to ask your question of Windows Live is inside Windows Live help forums. Experts specialize in all things, Windows Live, and would be delighted to help you with your questions. Please choose a product below to be redirected to the appropriate community:

     

    Windows Live Mail

    Windows Live Hotmail

    Windows Live Messenger

    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums to www.windowslivehelp.com.

  • 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;
    
  • Package to generate random values, based on a model

    I need to generate thousands of test strings based on a template (LLNNNNLL, where L stands for letter and N represents the numbers).
    I was able to create, on a table, any useful combination: the next step is to get that 'good' a few tickets.

    My problem is that using the following syntax I get tickets with "close to" number... just because I created using a sequence
    SELECT TICKET_CODE
    FROM TICKET_WELL SAMPLE (1) 
    WHERE OWNER = 'OWNER_NAME'
    AND rownum < 10;
    I mean: AB1001CD, AC1003CB, BB1002AD...
    while I need to get these tickets: AB1001CD, AC4667CD, SD8592GD etc...

    First question: is there a like DBMS_RANDOM package that accepts as input a boss so I can simply replace MY package to create the TICKET_WELL table?
    Second: Is there another way (right) to select a table trying to get the lines in a random order?
    Third: If both answers are not... is there a way to mix the rows of a table to another?

    Any suggestions are welcome.

    Thank you
    Marco

    Here's a function I hit upwards to generate a randon number, based on an input mask.

    create or replace
    function random_string( p_mask           in varchar2)
    return varchar2
    as
    v_random_number integer;
    v_random_letter varchar2(1);
    v_mask varchar2(20) := p_mask;
    v_character varchar2(1);
    v_random_string varchar2(20);
    begin
    for i in 1 .. length(v_mask)
    loop
    if substr(v_mask,i,1) = 'L'
    Then
        v_random_number :=  dbms_random.value(1,26);
        v_character := chr(64+v_random_number);
    elsif substr(v_mask,i,1) = 'N'
    then
       v_random_number := dbms_random.value(0,9);
       v_character     := v_random_number;
    end if;
    v_random_string := v_random_string||v_character;
    end loop;
    return v_random_string;
    end;
    

    To select lines in a random order, you need to store the random number with a column, for example rowno and create an index on rowno.

    create table random_rows
    (rowno number,
      random_string varchar2(20)
    );
    

    then to get a random line, you can use

    declare
    v_rowno integer; -- must be integer
    begin
    v_rowno := dbms_random.value(1, v_rows_in_table);
    select random_string
    into v_random_string
    from random_rows
    where rowno := v_rowno;
    end;
    

    You can also replace the random line of the next generated random_string.
    The only thing is that you can not guarantee that the random_string is unique,
    If you need a unique index on the column of random_string, and he tries to insert a duplicate, you should try to insert another random number;

  • Search for the string in the string table and see the following value in the line

    Hi, I'm new I have LV and I do a Vi that read worksheet values and generates 2d channels of the same spreadsheet table. For the moment everything I need is a function that find specyfic string in this table and show the next value in a line. As:

    Table:

    a; b
    c; d
    f; g

    example: find the 'c '.

    VI shoud show "d".

    Concerning

    Not a bad homework problem.  Do it with pencil and paper.  Write your table and pretend you're the computer.  What you want to do (step by step)?  What questions do you have?

    Now that the translation a bit to computers.  You mentioned that the data is in an array of strings.  What structures (LabVIEW) work with tables?  [Do you know how to work with tables?  [Otherwise, review some of LabVIEW Tutorial material - see top right of the first page of the Forum].  What do you know about channels?  What questions you need to ask questions on the channels?  What do you know about string functions?

    Watch these things in some LabVIEW code, 'feed' some data and see what he does.  If it seems to do things "unexplained", you can try to look at the block diagram to run by turning the performance highlight (and if you don't know what that means, use the help of LabVIEW and see the tutorials).

    Bob Schor

  • 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
    
  • place all of the values on a line

    Hi, people.

    I have the situation of a query result set

    Val (HAE) 1 time2 time3 of cod
    1 to 18:30 null null
    1 a 20:30 null null
    1 a null null 21:40
    2 b 10:27 null null

    understand 'null' or empty spaces or null

    How do I show record 1 i a line, I need this way

    1 18:30 to 20:30 21:40
    2 b 10:27



    Thank you...

    Published by: claudioaragao on 05/07/2012 09:36

    Published by: claudioaragao on 05/07/2012 09:38

    Hello

    claudioaragao wrote:
    but I can´t do with values of time, I get the error ora-01722... ?

    You can do this with all values.

    Display a test script complete (including CREATE TABLE and INSERT statements for some examples of data with your query) for people who want to hellp you can recreate the problem and test their ideas.
    It is very difficult to tell what you're doing wrong without knowing what you are doing.

  • 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.

  • Select the new value from a line in a group of

    I would like on the following query select the value of the new_cost of the column that belongs to the line with the new date in the column m.creation_date, instead of using max (new_cost)
    select s.segment1, segment2, m.organization_id, sum(primary_quantity), max(new_cost)
    from inv.mtl_material_transactions m, inv.mtl_system_items_b s
    where s.segment2 = 1000435
    and m.organization_id = 83
    and s.organization_id = 136
    and m.inventory_item_id = s.inventory_item_id
    group by s.segment1, s.segment2, m.organization_id 
    order by s.segment1, s.segment2, m.organization_id 
    for example, the following table I would choose the new_cost of the line with creation date 20/08/2010 14:37 (line 4)

    SEGMENT1 SEGMENT2 ORGANIZATION_ID PRIMARY_QUANTITY NEW_COST CREATION_DATE
    1 1000435 83 0,66668 175.500 06/04/2010 16:41
    1 1000435 83 1 189.106 22/06/2010-11:54
    1 1000435 83 - 0, 58333 189.106 2010-07-19 11:55
    1 1000435 83 1 198.459 20/08/2010 14:37
    1 1000435 83 - 0, 5 189.106 08/11/2010 18:12

    Hello

    Another way is to use the FIRST aggregation or the LAST function:

    select    s.segment1, segment2, m.organization_id, sum(primary_quantity)
    ,       MAX (new_cost) KEEP (DENSE_RANK LAST ORDER BY m.creation_date NULLS FIRST)     AS latest_new_cost
    from        inv.mtl_material_transactions       m
    ,        inv.mtl_system_items_b       s
    where       s.segment2          = 1000435
    and        m.organization_id     = 83
    and       s.organization_id     = 136
    and       m.inventory_item_id     = s.inventory_item_id
    group by  s.segment1, s.segment2, m.organization_id
    order by  s.segment1, s.segment2, m.organization_id
    ;
    

    MAX (new_cost) tells what to do in the case of a tie (where two or more lines in the same group have same latest date_creation). MAX means taking the biggest contenders. If these links are impossible to your table, then it does not matter if you say MAX or MIN it.

  • Get the range of values such as the value of my line

    Hello

    I want one of my column in the table ("for example: column name = ' GVW") appears as below
    {code}
    PBV
    ----------------
    0-> 5
    5. > 10
    10 > 15
    {code}


    The values of the line comes from the table, called report_range_parameters table and it looks like in below

    {code}

    ID group name min_value max_value
    1 gvw_group 0 5 gvw_name
    gvw_group 2 5 10 gvw_name
    3 gvw_group 10 15 gvw_name

    {code}

    Here's my INSERT sample data.
    {code}

    INSERT INTO REPORT_RANGE_PARAMETERS (ID, GROUP, NAME, MIN_VALUE, MAX_VALUE)
    VALUES ('1 ', 'SPEED_GROUP', 'SPEED_NAME', '0', 5')
    INSERT INTO REPORT_RANGE_PARAMETERS (ID, GROUP, NAME, MIN_VALUE, MAX_VALUE)
    VALUES ('2 ', 'SPEED_GROUP', 'SPEED_NAME', '5', 10')
    INSERT INTO REPORT_RANGE_PARAMETERS (ID, GROUP, NAME, MIN_VALUE, MAX_VALUE)
    VALUES ('3 ', 'SPEED_GROUP', 'SPEED_NAME', '10', 15')


    {code}

    How I write a query to get the values of line like below?

    -----------------
    GVW |
    -----------------
    0-> 5
    5. > 10
    10 > 15



    Thank you

    Hello

    SELECT min_value || ' -> ' || max_value AS GVW FROM REPORT_RANGE_PARAMETERS;
    

    Kind regards

    Published by: Walter Fernández on 12 June 2009 20:45

  • 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

  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • 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}

  • How to query the name summary of custom line of Section header information

    I need a query which can help me to retrieve the contents of a header line custom section information name.  We have a couple of tables Denorm when data are denormalized, the field row_name is only show the name of alias denormalized.  We would like to be able to draw the contents of the line header information section name?  How can we use the alias denorm name and join another table to find the associated summary name?

    The following query returns the name of the line as well as the line name denorm, for a custom section, where we specify the section custom denorm table. Deserve you this to do otherwise, it depends on how you want to retrieve information. Is that what you are looking for?

    SELECT ml. Name [rowName], ml.langID, dr.NAME [denormRowName], Dr. FKROWTEMPLATE, dt. GENERATED_TABLE_NAME

    OF DENORM_CS_ROW dr

    DENORM_CS_TABLE dt on Dr. FK_DENORM_TABLE_ID = dt.ID inner join

    commonextendedattributeml ml on Dr. FKROWTEMPLATE = ml.fkOwner inner join

    where dt.NAME = 'myDenormTableName. '

Maybe you are looking for