Join the various documents on a single line

Hello

How to unite into a single line a result with more than one record?

That is to say:
cod_prod     tax     tax_name     value
1          1     tax1          5
1          2     tax2          10
1          3     tax3          8
2          1     tax1          3
2          2     tax2          6
3          1     tax1          6
4          1     tax1          7
4          2     tax2          12
4          3     tax3          6
4          4     tax4          9
Back to this:
cod_prod     tax     tax_name     value     cod_prod     tax     tax_name     value          cod_prod     tax     tax_name     value     cod_prod     tax     tax_name     value
1          1     tax1          5     1          2     tax2          10          1          3     tax3          8
2          1     tax1          3     2          2     tax2          6
3          1     tax1          6
4          1     tax1          7     4          2     tax2          12          4          3     tax3          6     4          4     tax4          9
-Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
-OEL 2.6.32 - 100.0.19.el5

Use 'pivot' which is available in oracle 11g

Tags: Database

Similar Questions

  • How to change the background color of a single line

    Hi, OTN,.

    I use JDeveloper with ADF faces 11.1.1.2 in the view layer. My question is how to change the background color of a single line in af:table?.

    Hi idir Mitra
    You can use EL to bind column for example inlineStyle (#{row.id == null?' background-color: rgb (255,214,165);':'background-color:red'})})

    Cordially Abhilash.S

  • convert the column values to a single line...

    I have to return the column values to a single line separated by commas.
    If the nulls in the column just ignore without a comma.
    Here is one for example. There are three values and two NULL values in the table
    SQL> select ID from temp_fa;
    ID
    -----
    
             1
             2
    
             3
    
             5
    
    6 rows selected.
    
    
    I am expecting an output as 1,2,3,5
    Help, please

    There is always more than one title in the Oracle world ;)
    You can use the TRIM, for example (same configuration as your example):

    hoek&XE>  create table t as select level col  from dual connect by level <= 6;
    
    Tabel is aangemaakt.
    
    hoek&XE> update t set col = null where col in (1,3,5);
    
    3 rijen zijn bijgewerkt.
    
    hoek&XE> select * from t;
    
           COL
    ----------
    
             2
    
             4
    
             6
    
    6 rijen zijn geselecteerd.
    
    hoek&XE> select ltrim(sys_connect_by_path(col, ','), ',') output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6,,,
    
    1 rij is geselecteerd.
    
    hoek&XE> select trim ( both ',' from sys_connect_by_path(col, ',')) output
      2  from  ( select col
      3          ,      row_number() over (order by col) rn
      4          from   t
      5        )
      6  where connect_by_isleaf=1
      7  start with rn=1
      8  connect by rn = prior rn+1;
    
    OUTPUT
    -------------------------------------------------------------------------------------------------------------
    2,4,6
    
    1 rij is geselecteerd.
    
  • All the dimension values must be single line values

    I created a Simple hierarchy with the following levels:

    Category
    Subcategory
    Agenda

    The mapping of the hierarchy above is based on a table where the column list are as follows:

    ITEM_KEY
    NOM_ELEMENT
    BRAND_KEY
    BRAND_NAME
    CATEGORY_KEY
    CATEGORY_NAME
    SUBCATEGORY_KEY
    SUBCATEGORY_NAME


    Item_key is the primary key for this table and nom_element is also unique.

    When I maintain this dimension, the following error occurs:


    An error occurred on the server
    Class of error: failure of the Express
    Server error descriptions:
    INI: Error creating a generic Manager definition to < BuildProcess > TxsOqConnection::generic
    INI: XOQ-01600: OLAP DML error "all dimension values must be single line values." while executing DML 'SYS. AWXML! R11_COMPILE_ATTRIBUTES('ITEM.) DIMENSION') ', generic for TxsOqStdFormCommand::execute '.

    at oracle.olapi.data.source.DataProvider.callGeneric (unknown Source)
    at oracle.olapi.data.source.DataProvider.callGeneric (unknown Source)
    at oracle.olapi.data.source.DataProvider.executeBuild (unknown Source)
    to oracle.olap.awm.wizard.awbuild.UBuildWizardHelper$ 1.construct (unknown Source)
    to oracle.olap.awm.ui.SwingWorker$ 2.run (unknown Source)
    at java.lang.Thread.run(Thread.java:595)

    The essential error is "all the dimension values must be unique row values", which means that the server tries to create a dimension of AW member containing a newline character. The error occurs under the SYS. AWXML! Procedure R11_COMPILE_ATTRIBUTES, which is where the attributes are indexed (i.e. transformed into dimension members). If my guess is that one of your attributes (likely mapped to a column _NAME) contains a new line.   The solution is to disable the indexing for that attribute.   In terms of AWM you must make sure the following boxes are not activated in the "Général" pane

  • Create the views level attribute columns
  • Index

  • The visible part of a SINGLE line of overprinting?

    Can someone confirm this for me:

    ONLY the visible part of an overprinted line won't be actually printed?  If the part of a line is obscured by an opaque layer ABOVE, it does NOT PRINT.

    -Jay

    You can check in the overprint preview and/or to obtain an overview of separations.

  • Live the legends 'crushing' on a single line?

    Hello

    OK-I use the live caption feature and I placed a few lines of copy in the region of Descriptions of Photoshop files. When I choose this option in my configuration of legends and then run the living legends, all words crashing on one line?

    There is nothing weird about the follow-up and all the descriptions that was originally a fine line.

    Any thoughts there?

    Thank you!
    Babs

    Do not coil the live legend. It's simply the way they work.

    Convert the text caption.

    Bob

  • The most used only a single line of site Web page because of new gear at top

    I used the "Awesome" my homepage page. It was my most used sites 8 on the 2 rows of 4. After the last update, I see 4 websites because the train at the top of the page all moves down and no longer has room for 2 rows. Y at - it a setting or something I can change to get the two rows to show once again?

    This page has a complicated construction, but you can use the custom style rules to change. In particular, you can leave the miniature box grow to occupy the total space available and, if necessary or desired, to have a scroll bar.

    I have not worked entirely what rules of style make the most sense, and not sure I will have time during the day today.

    If you are interested in a complementary solution, it was mentioned several times on the forum: https://addons.mozilla.org/firefox/addon/new-tab-tools/

  • converting and application of single line

    Greetings,

    The data tables and release date are on the bottom.
    Tables of process contains the id of the base of different dealing with the fabric. 1 single command will have (at most) 2 or 1 process different store (s). Need to create a query list all order no as well as names of processes, work shop. It also requires to convert each numeric field to 0 if the value is null. I was able to create a query as follows but stuck on do not know how the order number listed as single line more this conversion of numeric field when there are 2 different process no.. Can you help me? I know there are a lot of gurus here who can give me a lift. Thank you.

    Select
    B.porderno,
    Decode(pprocessno,1,A.Name,null) as '1 storename. "
    Decode(pprocessno,2,A.Name,null) as '2nd storename.
    Decode (pprocessno, 1, NVL(B.PLength,0), null) as "1 length."
    Decode (pprocessno, 2, NVL(B.PLength,0), null) as '2nd length.
    of test_store2 A, test_process B
    where A.storeid = B.pstoreid...



    CREATE TABLE test_store2
    (storeid NUMBER (3.0) not null,)
    (20) is not name VARCHAR2 null,
    addr VARCHAR2 (30) not null

    )
    /
    CREATE TABLE test_process
    (porderno NUMBER (10,0) not null,)
    pstoreid number (3.0) not null,
    pprocessno number (3.0) not null,
    PLength number (3.0).
    pwork VARCHAR2 (30)

    )

    /
    INSERT INTO test_store2 (storeid, name, address)
    VALUES (001, 'papas, 123 route1')
    INSERT INTO test_store2 (storeid, name, address)
    VALUES (002, "tcbi" ', ' st 652 sky ")
    INSERT INTO test_store2 (storeid, name, address)
    VALUES (003, 'tutu club' ', ' 888 grand ave ")
    INSERT INTO test_store2 (storeid, name, address)
    VALUES (004, "stinkys', ' 432 bobo st")
    /

    INSERT INTO test_process (porderno, pstoreid, pprocessno, plength, pwork)
    VALUES (811, 2, 1, null, "prepNdye")
    INSERT INTO test_process (porderno, pstoreid, pprocessno, plength, pwork)
    VALUES (811, 1,2,30, "cutting")

    INSERT INTO test_process (porderno, pstoreid, pprocessno, plength, pwork)
    VALUES (812, 1,1,10, 'dye')

    INSERT INTO test_process (porderno, pstoreid, pprocessno, plength, pwork)
    VALUES (813, 3,1,40, 'preparation')
    INSERT INTO test_process (porderno, pstoreid, pprocessno, plength, pwork)
    VALUES (813, 4.2, null, 'dye')
    /
    Search result page layout
    order  1st storename 2nd storename      1st length    2ndlength         1stwork            2nd work
    
    811     tcbi                papas             0             30            prepNdye           trimming
    812     papas                                 10             0            dye
    813     tutu club           stinks            40             0            prep               dye

    Hello

    I wanted to answer the OP, not Florian. I'm sorry.

    In your [last thread | http://forums.oracle.com/forums/message.jspa?messageID=3514404#3514404], we have treated the two stores as if they were in the two tables, using two copies of the test_store2 table.
    We can do the same thing with the process: the two process, as if they were in the two tables, using two copies of the process table.
    Since it may not be a 2nd treatment, the 2nd copy of the table of alternation (and the second copy of the table test_store2, which is distal in relation to it) must be attached to an outside.

    SELECT    p1.porderno
    ,       s1.name          AS "1st storename"
    ,       s2.name          AS "2nd storename"
    ,       NVL (p1.plength, 0)     AS "1st length"
    ,       NVL (p2.plength, 0)     AS "2nd length"
    ,       p1.pwork             AS "1st work"
    ,       p2.pwork             AS "2nd work"
    FROM            test_process     p1
    JOIN            test_store2     s1     ON     p1.pstoreid     = s1.storeid
                               AND     p1.pprocessno     = 1
    LEFT OUTER JOIN     test_process     p2     ON     p1.porderno     = p2.porderno
                                     AND     p2.pprocessno     = 2
    LEFT OUTER JOIN     test_store2     s2     ON     p2.pstoreid     = s2.storeid
    ORDER BY  p1.porderno
    ;
    

    Another approach, since you want to exit with a line by porderno, would be to start by creating a version of the process table that has one line per processid, using GROUP BY, as Florian, and then join two copies of the table of test_sorte2 this result set.

    Published by: Frank Kulash, June 9, 2009 10:45

  • How to set up single-line message headers?

    Previously, in the message display area, I had configured Thunderbird so that a message appears that the subject of the message in the message header section just above the body of the message. But I just upgraded to to 38.1.0 and now I have in reserve, [address], in the header box, although I've seen-> headers-> Normal (Compact) set.

    Please tell us how to get back to the option just to display the subject line. Real estate vertical display is much too precious to not having the capacity of the old view of a single line.

    Thank you
    [email protected]

    Install this add on.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/compactheader/?src=HP-DL-featured

    The normal headers view removes the routing information only. It has nothing to do with what you are trying to accomplish.

  • I would like to organize my toolbars to fit on a single line

    I have so many toolbars, some are really short and I wish I could move them if the courts fit on a single line.

    You are welcome.

    Please click the button of resolved next to the answer that solved your problem of Firefox support, when you are connected.

  • All dimension values must be single line values

    Hi all

    I have a dimension long_description attribute mapped to a column of text that contains a character "/ n". When I try to load dimension I get following error.


    An error occurred on the server
    Class of error: failure of the Express
    Server error descriptions:
    INI: error creating a generic Manager definition to < BuildProcess > TxsOqConnection::generic
    INI: XOQ-01600: OLAP DML error "ORA-34052: all the dimension values must be single line values." while executing DML 'SYS. AWXML! R11_COMPILE_ATTRIBUTES('TEST.) DIMENSION') ', generic for TxsOqStdFormCommand::execute '.

    If I delete the mapping between my column of text in the description attribute long size loads very well.

    It was happening because my text column contains several lines? text seems valid for reporting purposes (I mean having several lines)

    Thank you
    Dietsch.

    Analytic workspace dimensions do not support dimension members that contain new lines. This assumption is so integrated in language OLAP DML that it is difficult to see how it could ever be changed. Therefore, you cannot map a level (or hierarchy) key to a column that contains values to the new lines. But in your case you map an attribute, not a level key, so the error message is confusing. The problem is that your long description attribute is "indexed", which means that it is implemented using a DIMENSION and a RELATIONSHIP rather than a VARIABLE. To illustrate, I created a dimension named TEST with two levels, A and B, and one attribute, LONG_DESCRIPTION. The page of an attribute in AWM has two check boxes 'Create columns in views level attribute' and 'Index' that control how the attribute is being implemented.

    This is what is created in the AW if both are false.

    ->listnames like '%TEST%LONG%'
       1 VARIABLE
       ---------------------
       TEST_LONG_DESCRIPTION
    

    This is what is created if "Index" is checked.

    ->listnames like '%TEST%LONG%'
       1 DIMENSION                    1 VARIABLE
       ----------------------------   ----------------------------
       TEST_LONG_DESCRIPTION_INDEX    TEST_LONG_DESCRIPTION_STORED
    
       1 RELATION
       ----------------------------
       TEST_LONG_DESCRIPTION
    

    And here's what you get if you check "create columns for the level attribute of views."

    ->listnames like 'TEST%LONG%'
       2 DIMENSIONs                     3 VARIABLEs
       ------------------------------   ------------------------------
       TEST_A_LONG_DESCRIPTION_INDEX    TEST_A_LONG_DESCRIPTION_STORED
       TEST_B_LONG_DESCRIPTION_INDEX    TEST_B_LONG_DESCRIPTION_STORED
                                        TEST_LONG_DESCRIPTION
    
       6 RELATIONs
       ------------------------------
       TEST_A_LONG_DESCRIPTION
       TEST_A_LONG_DESCRIPTION_HIER_U
       TEST_A_LONG_DESCRIPTION_UNIQUE
       TEST_B_LONG_DESCRIPTION
       TEST_B_LONG_DESCRIPTION_HIER_U
       TEST_B_LONG_DESCRIPTION_UNIQUE
    

    The thing to note is that if you check one of these boxes, then your attribute is implemented by using a dimension of AW and AW relationship. This gives a good performance, but imposes the limitation that your attribute values cannot contain newlines. The obvious solution is to uncheck both boxes so that your attribute is implemented as a VARIABLE. If you absolutely have indexed attributes, so I guess you can use the SQL REPLACE function to change the new lines in escaped to the mapping layer

    GLOBAL > select REPLACE('a
      2  b', '
      3  ',
      4  '\n')
      5* from dual
    /
    
    REPL
    ----
    a\nb
    
    GLOBAL > select REPLACE('a\nb', '\n','
      2  ')
      3* from dual
    /
    
    REP
    ---
    a
    b
    

    You must convert the escape sequence in a new line endangered.

  • join in the query with the result of a single line

    Hi all

    I have two tables
    create table item(item_id number primary key,
    item_desc varchar2(200));
    
    create table item_properties(item_id number references item(item_id),
    property_name varchar2(20),
    property_value varchar2(100));
    I insert the following records
    insert into items values(1,'CPU');
    insert into item_properties values(1,'RAM','2gb');
    insert into item_properties values(1,'PROCESSOR','2ghz');
    insert into item_properties values(1,'HARDDISK','2ghz');
    commit;
    now I want a query that produces the following results
    item_id      RAM      PROCESSOR         HARDDISK
    1              2gb        2ghz              2TB
    How to generate this result?
    I create a query, but it generates several lines, instead I need a single line like above.
    select i.item_id,p.property_value from items i , item_properties p
    where i.item_id=p.item_id and i.item_id=1;
    Kind thanks.

    Published by: Maahjoor on May 7, 2013 12:22 AM
    select i.item_id,
           max(decode(p.property_name,'RAM',p.property_value)) ram,
           max(decode(p.property_name,'PROCESSOR',p.property_value)) processor,
           max(decode(p.property_name,'HARDDISK',p.property_value)) hd
    from items i , item_properties p
    where i.item_id=p.item_id
    and i.item_id=1
    group by i.item_id;
    

    Or pivot to 11g

    with details as
    (
    select i.item_id,p.property_name,p.property_value
    from item i , item_properties p
    where i.item_id=p.item_id
    and i.item_id=1
    )
    select *
    from details
    pivot
     (
       max(property_value) for property_name in ('RAM','PROCESSOR','HARDISK')
     );
    

    Published by: JAC on May 7, 2013 13:04

  • Value of the element are clear when I joined the document,

    Hi friends,


    I created a form and I have two reports on the same page. First of all is the list of all the Document, and the second is the list of all the attached Document.

    first of all, I have to fill out all the information to the point after that I have have attached the report document, when I attach the document then attached document come in two second report.

    Problem is when I filled all the points with value and atcchted document page is update then all value elements are clear.
    I don't want the value of the items when I joined the paper.

    Another problem is I m facing this page, if I refresh the page then a single document is automatically attached or add in the second rerpot.

    My workspace details

    Workspace: IMPROVE THE SKILLS
    User: [email protected]
    Password: desomu

    Application No.: 42370
    Page no. 4


    How can I attached document with clear.


    Thank you.

    Ok

    See the page now.

    'Fixing' your link on the list of the documents was not submit the page, he called to a URL that has just passed the value selected in the FILE_OBJ_ID.

    I've changed that to call a javascript function called addAttachment having set the value of a new hidden page element called P4_FILE_OBJ_ID and then the page submitted. All entries for the other entry points are saved then as well. I moved the process that adds the file selected in the table DUMY_SELECTED_ATTCH_FILE to work on submit it instead of loading the page. I also updated the list of documents in order to exclude items that have already been picked - unless you want duplicates?

    Another thing that you should consider...

    If you have multiple users doing so at the same time, the DUMY_SELECTED_ATTCH_FILE will contain documents for all THE users, so all users send the same accessories. You should consider adding a username column in the DUMY_SELECTED_ATTCH_FILE table and assign to this v ('APP_USER') so that you can identify the files selected by the current user only

    Andy

  • SELECT SQL to merge the text of different lines into a single line

    Hello

    I need to create a Select statement to merge multiple lines in a single text. I have a table with the following data:
    SQL> DESC doc_comments
     Name                                                  Null?    Type
     ----------------------------------------------------- -------- ------------------------------------
     DOC                                                            NUMBER
     COMMENTS                                                       VARCHAR2(30)
    
    SQL> SELECT * FROM doc_comments
      2  /
    
           DOC COMMENTS
    ---------- ----------
             1 Note A
             1 Note B
             2 Note C
             2 Note D
             2 Note E
             3 Note F
    
    6 rows selected.
    I need to create a query on the table to show a result like this:
    DOC          COMMENTS
    ------------ --------------------------
               1 Note A, Note B
               2 Note C, Note D, Note E
               3 Note F
    A possible solution would be to create a function to merge the text of the various lines and then use it in the query, but I'm not allowed to create any function in the database, I can use a simple SELECT statement.

    Any ideas on how I can do?

    Assuming that comments contain no vertical bar (|) character:

    with doc_comments as (
                          select 1 doc,'Note A' comments from dual union all
                          select 1,'Note B' from dual union all
                          select 2,'Note C' from dual union all
                          select 2,'Note D' from dual union all
                          select 2,'Note E' from dual union all
                          select 3,'Note F' from dual
                         )
    select  doc,
            replace(ltrim(sys_connect_by_path(comments,'|'),'|'),'|',', ') comments
      from  (
             select  doc,
                     comments,
                     row_number() over(partition by doc order by comments) rn
               from  doc_comments
            )
      where connect_by_isleaf = 1
      start with rn = 1
      connect by doc = prior doc
             and rn  = prior rn + 1
      order by doc
    /
    
           DOC COMMENTS
    ---------- ----------------------------------------
             1 Note A, Note B
             2 Note C, Note D, Note E
             3 Note F
    
    SQL> 
    

    And if the comments may contain the vertical bar (|), then replace the hose in the code above with a character that is not used in the comments.

    SY.

  • When you type an e-mail, when I go to the next line, it jumps two lines instead of a single line. How can I fix it?

    I was typing an email and when I would go to the next line, it will skip two lines instead of a single line. How can I fix the problem?

    I'm not sure that you understand the problem. Could include a screenshot of it just after what happens?

    If you need help to create a screenshot, please see How to make a screenshot of my problem?

    Once you have done so, attach the file to screen shot saved to your post on the forum by clicking on the button Browse... under the box to post your reply . This will help us to visualize the problem.

    Thank you!

Maybe you are looking for

  • Calls from Skype on IPad and IPhone sounds do not

    Since on the Skype these latest updates when I get a Skype call rings on my main PC, but not on my iPhone and iPad. It's very irritating because my main pc is located in my basement, and I can't always hear it sounds. This means also when I'm out and

  • Need FN and multimedia driver for Windows XP

    Hello I love this laptop!I need driver for the FN and the MULTIMEDIA keys (brightness, red led and so on). Please help me.

  • Toshiba SD Bluetooth SDIO card - BT00P to use WinCE2003 PDA?

    I have a Toshiba SD - BT00P Bluetooth SDIO card.I would use in Yakumo DeltaX GPS device. This PDA has SD/SDIO/MMC taken and uses the system of Windows Mobile 2003. Also I would like to connect Yakumo DeltaX GPS for my Nokia 6230i device, using the SD

  • Starting plays do not?

    I normally reboot (power cycle) my phone every two days just for good measure, and I noticed that the startup sound does not play for some reason any. If anyone else has experienced this?

  • I got a pop up ad appear.

    : I called the number, but I don't give any personal information. While the guy told me the code to download the system, I hung up. Should I be worried? All I have while on the phone was force quit safari, press SHIFT and safari and enter the website