display the columns as rows in the table of non-unique key

Hi OTN/users, I hope you can help me

Given a table:

create table t (varchar2 (30), int b, int, date c);

with these data in:

insert into values t (a1, 40, to_date (December 1, 2012 '));
insert into values t (a1, 50, to_date (December 1, 2012 '));
insert into values t (a1, 60, to_date (December 1, 2012 '));
insert into values t (b1, 10, to_date (December 1, 2012 '));
insert into values t (b1, 20, to_date (December 1, 2012 '));
insert into values t (b1, 30, to_date (December 1, 2012 '));
insert into values t (c1, 60, to_date (December 1, 2012 '));
insert into values t (c1, 70, to_date (December 1, 2012 '));
insert into values t (c1, 80, to_date (December 1, 2012 '));

-I want the output columns for each of the 'a' as a single line ex:

A1 40 50 60 1 December 2012
B1 10 20 30 December 1, 2012
...

I was almost right, but "a" neck repeats 4 times for each line of output:

A1 40
50 A1
A1 60
A1 1 December 2012

-I want to exit repeat delete the first column "a" but see the rest in a straight line.

I tried various things (Pivot, Rollup, etc.), but the fact that I'm in overlay on a table with no unique lines complicated things maybe.
Any help would be appreciated

Hi Kim,

Kim Berg Hansen wrote:
Even [url http://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:5658416800346527104] Tom agrees with Nicosa ;-)

Very honored that Tom has decided to use my solution. ;-) ;-) ;-)
But I guess that means that the OP may not like here to mark the thread as an answer.

Tags: Database

Similar Questions

  • Using the procedure to display the table of multiple data

    Hi, I need help for the procedure in oracle

    I want to create the procedure to display the table of multiples with sample plan

    with a parameter imployee_id to display an employee_id, name, function, start_date, end_date

    IAM using this query to select more than one table

    SELECT e.employee_id, e.first_name, j.job_title, h.start_date, h.end_date

    E EMPLOYEES

    JOIN j jobs

    ON j.job_id = e.job_id

    JOIN the job_history:

    ON h.employee_id = e.employee_id

    WHERE e.employee_id = 200;

    Thanks for the help

    Blu and Billy showed you the 'real' solution. You can display the data returned by a cursor ref in SQL Developer, too:

    http://www.thatjeffsmith.com/archive/2011/12/SQL-Developer-tip-viewing-refcursor-output/

    Yet as a duty for a beginner is generally do not have the expected solution. Usually, teachers want to see you using a LOOP and dbms_output. something like

    DECLARE

    Xy CURSOR IS

    SELECT whatever

    As much as;

    BEGIN

    FOR r IN xy LOOP

    dbms_output.put_line (r.col1 |' # ' | r.col2);

    END LOOP;

    END;

    Of course this suggestion will inaugurate a discussion abusing DBMS output but I keep my position that it is authorized to use it for learning the basics.

  • error displaying the tables of mysql in the data Panel

    I try to display the tables on my local mysql (MySQL 5.1 v) database. I get this error in the data panel when I develop the tables:

    "When executing getComponentChildren in Connections.htm, the following JavaScript error has occurred:
    "On line 64 of the file"C:\\...\Dreamweaver 8\Configuration\Components\Common\Connections\ConnectionsCommon.js": TypeError: dwscripts.isDateDBColumType is not a function".

    When the elements of array must be listed, I just see a branch that says "Loading"... "and it just sits there. I have the 8.0.1 update installed and just cannot know what the problem is. I have several installed extensions (especially WebAssist and a few others).

    Someone knows what to do to fix it? Am I missing some info compatibility?

    Thank you...

    Good goooollllleeee. Reinstall Dreamweaver seemed to do the trick.

    Now, to reinstall the extensions and see if it was one of those who killed my previous installation...

  • JTable with custom column model and model table does not display the table header

    Hello

    I create a JTable with a custom table model and a custom column template. However the table header is not displayed (Yes, it's in a get). I have narrowed the problem down in one compilable example:

    Thanks for your help.
    import javax.swing.*;
    import javax.swing.table.*;
    
    public class Test1 extends JFrame
    {
         public static void main(String args[])
         {
              JTable table;
              TableColumnModel colModel=createTestColumnModel();
              TestTableModel tableModel=new TestTableModel();
              Test1 frame=new Test1();
    
              table=new JTable(tableModel, colModel);
              frame.getContentPane().add(new JScrollPane(table));
    
              frame.setSize(200,200);
              frame.setVisible(true);
         }
    
         private static DefaultTableColumnModel createTestColumnModel()
         {
              DefaultTableColumnModel columnModel=new DefaultTableColumnModel();
              columnModel.addColumn(new TableColumn(0));
    
              return columnModel;
         }
    
         static class TestTableModel extends AbstractTableModel
         {
              public int getColumnCount()
              {
                   return 1;
              }
    
              public Class<?> getColumnClass(int columnIndex)
              {
                   return String.class;
              }
    
              public String getColumnName(int column)
              {
                   return "col";
              }
    
              public int getRowCount()
              {
                   return 1;
              }
    
              public Object getValueAt(int row, int col)
              {
                   return "test";
              }
    
              public void setValueAt(Object aValue, int rowIndex, int columnIndex)
              {
              }
         }
    }
    Published by: 802416 on October 14, 2010 04:29
    added
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    See http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableColumn.html#setHeaderValue (java.lang.Object)
    When the TableColumn is created, the default headerValue is null
    So the header ends up rendered empty label (probably of size 0 if the JTable calculates its size of header based on the size of the default rendering tool).

    It worked:

         private static DefaultTableColumnModel createTestColumnModel()
         {
              DefaultTableColumnModel columnModel=new DefaultTableColumnModel();
                    TableColumn col = new TableColumn(0);
                    col.setHeaderValue("Header Title");
              columnModel.addColumn(col);
                    return columnModel;
         }
    

    Published by: jduprez on October 14, 2010 14:09
    Beaten by a fraction of a second!

    Published by: jduprez on October 14, 2010 14:10
    OK, by a split of 17 minutes, specifically: o)

  • will not display the table correctly; displays OK in Internet explore all versions

    Table will not correctly display in Firefox; Removes the first section of < b >... < /tr >, move the section 2 of < b >... < /tr > right. The table shows correctly in all versions of IE.

    You should never use several hyphens in a comment.
    Firefox will toggle the status comment after that each two hyphens (-), if you need a lot of luck with this many as in this case:

    <!----------------------------------Geograhphy, etc. ------------------------------------>
    

    Firefox treats the code that follows as comment until the next two "-" found in the next section. You can see through view > Source of Page as green comment.

    <!---------------------------------- Accessibility ------------------------------------>
    

    You're code here shows a < td > additional vacuum that causes a column empty to appear to the left, if that's what you mean.

    <!--<center>-->
    <TR align="center">
    <td>
    <td>
    <Font color="#ff00cc">
    <h2>Charleston</h2></font></td>
    <td>
    <Font color="#ff00cc">
    <h2>Savannah</h2></font></td>
    <td>
    <Font color="#ff00cc">
    <h2>Recommendation</H2></font>
    </TD>
    </TR>
    <td>

    You can use the DOM Inspector to examine the code.

  • How to display the table HP V1900 - 8G switch MAC address

    Hello!

    Someone probably knows...

    Is it possible to display the MAC addresses of computers connected to the switch HP V1900 - 8G (ditch the WEB or CLI). All managed switches, I worked with had something like "MAC address Table" or more to display the MAC address of the switch table.

    I found it by myself. There is a function under Tools/system that allows to download MAC table as a txt file.

    Manual switch, you can see only screenshot that there are these functions, but no description on it at all. You must pass your manual!

  • How can I display the table of contents for the iPod Touch to 6

    When I opened first of all iPod Touch Users' Guide, I used the table of contents (TOC) to locate and access sections in the manual. But, after looking through the manual for awhile, I tried to return to the table of contents, but it wasn't there! I have tried various things to see if the table of contents are being hidden, or if in some way, it has been deleted. Anyone can shed light on this mysterious event?

    What is the version of iBooks that you speak? There is an online version here: https://help.apple.com/ipod-touch/9/ Aha, I see the table of contents on the left disappears if you zoom before or make the narrow window and reappears if zoom you out or make it larger.

    TT2

  • table partitioned and unique keys

    I really don't understand why Oracle does not apply in some cases, unique keys.

    Let's say I have a table

    create table t (t_type not null, t_key not null, id not null, not null value)

    list partition (t_type)

    (

    type1 partition values ('ppp1"),

    rest of partition (default) values

    ) as

    Select "ppp" | rownum, rownum, rownum, rownum of double connect by rownum < = 100;

    And following changes in the indices for unique keys

    -1

    create index idx_1 on t (t_key, id);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -2

    create index idx_1 on t (t_key, id, t_type);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -3

    create index idx_1 on t (t_key, id, t_type) local;

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -4

    create an index only idx_1 on t (t_key, id);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -5

    create an index only idx_1 on t (t_key, id, t_type);

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -6

    create an index only idx_1 on t (t_key, id, t_type) local;

    ALTER table t add constraint t_uk unique (t_key) using index idx_1;

    Drop index idx_1;

    -7

    create index idx_1 on t (t_key, t_type, id) local;

    ALTER table t add t_uk unique constraint (t_key, t_type) using index idx_1;

    ALTER table drop constraint t_uk drop index;

    -8

    create an index only idx_1 on t (t_key, t_type, id) local;

    ALTER table t add t_uk unique constraint (t_key, t_type) using index idx_1;

    Drop index idx_1;

    I got the set of questions:

    1. first and second cases were performed with success while 4th and 5th failed.

    The only difference is that the overall index in 4th and 5th cases are unique.

    It is unclear why ' ORA-14196: specified index cannot be used to apply the constraint. ' has occurred.

    2. in the third case index is similar to that in second place with the only difference that it is local.

    Still, it is not clear why it failed with ORA-14196.

    3 and the last question why ORA-14196 arose in 8 cases, while the 7th, it didn't.

    The only difference is the local index in 8 cases is unique.

    Thank you

    Hi Alex

    (1) index 4 and 5 cannot be used to police the unique constraint as a unique index must have the same list of column under duress. Index 4, to establish in a non-unique index or to remove the column id of the index. To index 5, you will need to make a non-unique index or remove the columns id and index t_type.

    (2) 3 index cannot be used to the unique constraint of police that it is a local index and is not partitioned column (t_type) in both the definition of index/constraint. If allowed, this would require Oracle having to visit each partition to ensure that any new value of t_key is truly unique, that would not scale. Include the t_type column in the constraint and the index to both t_type and t_key as of the columns (so move the id column 3rd position) and it would be successful.

    (Index 3) 8 fails for the same reason as in 1). It's a unique index with a different column from the constraint list. Remove the id column of the index or to make it a non-unique index and it will be successful.

    In summary, a unique index MUST have the same list of column than the constraint and a local index MUST have the partitioning columns in both the definition of index/constraint.

    See you soon

    Richard Foote

    http://richardfoote.WordPress.com/

  • Diagram of all the tables list of primary key column names

    Hi people,

    I have a Scott user for example, I want to retrieve all tables primary key column names in the user Scott.

    can someone help me please.

    Thanks in advance,
    karmaya

    You can log in to SCOTT and try this

    select c.constraint_name
         , cc.table_name
         , cc.column_name
      from user_constraints c
      join user_cons_columns cc
        on c.constraint_name = cc.constraint_name
     where c.constraint_type = 'P';
    
  • Liaison on the rows in the table based on a key element

    Hello

    I have two separate tables in my form, A and B, with the following data:

    Table A:

    COMPANY_ID DATAITEM_1
    12345Data1Test1
    98765Data1Test2

    Table B:

    COMPANY_ID DATAITEM_2
    12345Data2Test1
    98765Data2Test2

    In both tables, the value of the COMPANY_ID in each row is selected by the user in a drop-down list. DATAITEM_1 and DATAITEM_2 are normal textfields.

    I've linked COMPANY_ID, DATAITEM_1, and DATAITEM_2 in two tables to the matching elements in my XML schema. The form now produces data that looks like this:

    ...

    < DATA >

    < > 12345 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_1 > Data1Test1 < / DATAITEM_1 >

    < / DATA >

    < DATA >

    < > 98765 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_1 > Data1Test2 < / DATAITEM_1 >

    < / DATA >

    < DATA >

    < > 12345 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_2 > Data2Test1 < / DATAITEM_2 >

    < / DATA >

    < DATA >

    < > 98765 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_2 > Data2Test2 < / DATAITEM_2 >

    < / DATA >

    ...

    What I'm trying to do, is to make my form to produce data like this:

    ...

    < DATA >

    < > 12345 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_1 > Data1Test1 < / DATAITEM_1 >

    < DATAITEM_2 > Data2Test1 < / DATAITEM_2 >

    < / DATA >

    < DATA >

    < > 98765 COMPANY_ID < / COMPANY_ID >

    < DATAITEM_1 > Data1Test2 < / DATAITEM_1 >

    < DATAITEM_2 > Data2Test2 < / DATAITEM_2 >

    < / DATA >

    ...

    In other words, I would like to bind DATAITEM1 and DATAITEM2 to a specific dataset based on the COMPANY_ID value on the same line. COMPANY_ID doing so here as the key.

    Could someone tell me if this is possible?

    I modified my example, tables with drop-down lists can be filled in with the code as preOpen event;

    this.clearItems ();

    list var = xfa.resolveNodes ('COMPANY [*]');

    for (var i = 0; i)< list.length;="">

    {

    var point = list.item (i);

    this.addItem (item.COMPANY_ID.rawValue);

    }

    The output event code then looks like;

    If (!.) COMPANY_ID. IsNull)

    {

    var company = xfa.resolveNode ("COMPANY. (COMPANY_ID). (RawValue_===_«_«_+_COMPANY_ID.rawValue+_»_») ");

    society. This.rawValue = DATAITEM_1.RawValue;

    }

    The new sample can be downloaded from https://acrobat.com/#d=SCOps1yz0powjzxs2L9n3w

    But you will have a lot of scripts to add the form, can they add the company duplicate lines and what happens once they have selected a company added the DATAITEM_1 (or DATAITEM_2) and then the company has changed, you need to remove the data entered or allow them to change there minds once again.

    Good luck

  • create materialized view log on the table without a primary key

    Hi all
    CREATE TABLE client_months 
    (
      SUBJ_CODE         NUMBER(4),
      SERV_CODE         NUMBER(4),
      DEBIT_CODE        NUMBER(4),
      PERIOD_NUM        NUMBER(2),
      PERIOD_NAME       VARCHAR2(40 CHAR),
      FIRST_MON_DAY     DATE,
      LAST_MON_DAY      DATE,
      VALUE_MON_DAY     DATE,
      MONTHES           NUMBER(4,2),
      GARDENING_WEIGHT  NUMBER(5,4),
      REASON_CODE       NUMBER(5),
      STAMP_ACTION      VARCHAR2(1 CHAR),
      STAMP_CDATE       DATE                        DEFAULT SYSDATE,
      STAMP_DATE        DATE,
      STAMP_USER        VARCHAR2(15 CHAR),
      REGION_CODE       NUMBER(9)
    )
    table created.
    
    CREATE UNIQUE INDEX client_months_UK  ON client_months 
    (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE)
    index created.
    
    CREATE MATERIALIZED VIEW LOG ON client_months with rowid;
    
    CREATE MATERIALIZED VIEW client_months_mv 
    BUILD immediate 
    REFRESH FAST ON COMMIT 
    AS 
    SELECT * FROM client_months;
    
    ORA-12014: table 'CLIENT_MONTHS' does not contain a primary key constraint
    I don't want to refresh the mview when validation is performed on the base table.
    And I don't want to change the base table by adding a primary key.

    is it possible to create the mview journal using the unique index? or another solution?
    Please help
    Thanks in advance
    Naama

    Naamas wrote:
    No,
    I already read this post!

    Then you read wrong:

    SQL> CREATE TABLE client_months
      2  (
      3    SUBJ_CODE         NUMBER(4),
      4    SERV_CODE         NUMBER(4),
      5    DEBIT_CODE        NUMBER(4),
      6    PERIOD_NUM        NUMBER(2),
      7    PERIOD_NAME       VARCHAR2(40 CHAR),
      8    FIRST_MON_DAY     DATE,
      9    LAST_MON_DAY      DATE,
     10    VALUE_MON_DAY     DATE,
     11    MONTHES           NUMBER(4,2),
     12    GARDENING_WEIGHT  NUMBER(5,4),
     13    REASON_CODE       NUMBER(5),
     14    STAMP_ACTION      VARCHAR2(1 CHAR),
     15    STAMP_CDATE       DATE                        DEFAULT SYSDATE,
     16    STAMP_DATE        DATE,
     17    STAMP_USER        VARCHAR2(15 CHAR),
     18    REGION_CODE       NUMBER(9)
     19  )
     20  /
    
    Table created.
    
    SQL> CREATE UNIQUE INDEX client_months_UK  ON client_months
      2  (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE)
      3  /
    
    Index created.
    
    SQL> CREATE MATERIALIZED VIEW LOG ON client_months with rowid
      2  /
    
    Materialized view log created.
    
    SQL> CREATE MATERIALIZED VIEW client_months_mv
      2  BUILD immediate
      3  REFRESH FAST WITH ROWID ON COMMIT -- pay attention to WITH ROWID
      4  AS
      5  SELECT * FROM client_months
      6  /
    
    Materialized view created.
    
    SQL>
    

    SY.

  • Write to the table, adding additional rows in the csv file

    Hi all

    I created a program that measure current over time.  It works well, but when I write to the spreadsheet, there are additional lines between the row of data.

    I've created a header file, which is passed into the while loop where the data entered in a table and then entered in the worksheet.  If I simply display the table, there is no additional lines, but when I open the file csv in excel, there are more lines.  I'm pretty new to labview, but everything works the way I want to (it's a simple program) apart from that.

    There is a trolley or jump back in your chain of row data.  You can get rid of that by adding a "trim whitespace" function between the function of "visa read" and "replace the subset of the table.

  • ADF table selected displayRow does not display the selected line

    Hello

    JDev 11.1.2.4

    I have a table with selection enabled and displayRow property the value selected. In the workflow, I have an ExecuteWithParams activity, and then a method activity that restores the current iterator of the line. Finally the activity view that displays the table.

    Restore the current line with key

    Iterator DCIteratorBinding = ADFUtils.findIterator ("MyIterator");

    iterator.setCurrentRowWithKey (currentKey); currentKey is a string

    The question I have is that the current line is properly restored, but the table does not display the page of "range" of the current line while the displayRow is the selected value. My table has 500 rows, the table displays the top 25 while the current line is the 500th line. I expect the table to display the line 475 to 500 line.

    What I am doing wrong?

    Thank you

    You can save the index lines before executing your method and then set the iterator to this index.

    The technique is described in this blog https://tompeez.wordpress.com/2016/02/12/naviagting-an-aftable-in-pagination-mode-from-a-bean/

    Timo

  • Select the row in the table to change in a form

    Hi all

    I use Jdeveloper 12.1.3.0.0 on windows internet explore 10.

    I have the following form and the read-only table. the form and the table that are both on the same object from view.

    click_edit.png

    When the user clicks a row in the table, I want to choose this line in the form above for editing purpose.

    How would I do that? the first column of the table is a primary key.

    I followed shayjdev vedio http://www.youtube.com/watch?v=e0IcnXLJUgU

    but the problem is that when I click the button CreateInsert (5th button left in my case), never clear the form for the opening of new record, instead, he put the table in input mode.

    kindly help me with this.

    Thank you.

    To create a new line, you drag the operation createInsert of the data control on the create new"" button. This should create the new row.  If you like the new line being the last of them using the link from dvohra21 to https://blogs.oracle.com/jdevotnharvest/entry/how_to_add_new_adf

    In this case, you must change the listener to the button action to point to the generation of listener action code of Frank.

    Timo

  • Need help to insert rows in the table to a custom table area

    Hi all

    I have a requirement as below.

    I have a page of the i invoke a popup search page and displaying the table data in the area of the table, this table I select lines and pressing the button and given in the basic page in the region of the table being filled, of data, I need to insert these lines into a custom table. Please help me how to achieve this. Basically, I need to insert rows from one table to a custom table region.

    Thnaks

    Hello

    Review the link, below, may be it will help you:

    https://forums.Oracle.com/thread/953885

    https://forums.Oracle.com/thread/2151775

    Please share your solution here, it will help others.

    Concerning

    Mahesh

Maybe you are looking for