Breaking one row in to mutiple rows

Hi all,
I am doing supplier conversion through ODI.
In legacy one supplier transacts in multiple currencies.
During conversion i have a requirement of creating one supplier site corresponding to each currency.
e.g. if in supplier site table invoice_currency_code is EUR,USD,RUR
then i have to break it in to three rows having invoice_currency_code as
Row1->EUR
Row2->USD
Row3->RUR
We can do the same using PL/SQL.
can we do same using ODI interfaces without procedures or SQL?

Hi,
I don't think that is a simple cartesian...
By my understanding you need to PIVOT the data from on single row to several lines, I create a single query to do it.
Test enviroment:
1) DDL
CREATE TABLE "ODI_TMP_ODS"."TST_PIVOT_CEZAR"
(     "COL_1" VARCHAR2(100) )
2) data
-- INSERTING into TST_PIVOT_CEZAR
Insert into TST_PIVOT_CEZAR (COL_1) values ('a12;b3;c567;d8;e;f;g;h');
Insert into TST_PIVOT_CEZAR (COL_1) values ('I12;J3;L567;M8');
3) query
the "----" is to substitute the spaces once it isn't possible show the spaces here.
--- select row_id,
---------- rtrim(ltrim(resultado, ';'),';') FINAL_RESULT
----- from (select tpc.rowid row_id,
------------------ substr(col_1, instr(col_1, ';', d.lvl - 1), instr(col_1, ';', d.lvl) - instr(col_1, ';', d.lvl - 1)) resultado
------------- from tst_pivot_cezar tpc,
------------------ (select level lvl
--------------------- from dual
-------------------- connect by level < (select max(length(col_1))
------------------------------------------ from tst_pivot_cezar
------------------- ) d
--- where resultado is not null
union all
--- select tpc.rowid row_id,
--------- substr(col_1, -(length(col_1) - instr(col_1, ';', -1))) FINAL_RESULT
------from tst_pivot_cezar tpc
order by row_id
This technique will give you several lines as result that you can associte by the row id.
At ODI you can use it in a procedure step as "insert as select" or as "source select target insert" too in a procedure step.
Does it help you?
Message was edited by:
Cezar Santos

Similar Messages

  • How to break one row records into 3 row records

    I have two tables which consists of date records,
    table1
    first_date second_date
    01-feb-10 01-mar-10
    tabl2
    new_date old_date
    01-jan-10 01-aug-10
    if first table dates falls between new_date and old_dates, i need to showit as three row records instead of1 row in table2

    Hi,
    1001383 wrote:
    I have two tables which consists of date records,
    table1
    first_date second_date
    01-feb-10 01-mar-10
    tabl2
    new_date old_date
    01-jan-10 01-aug-10
    if first table dates falls between new_date and old_dates, i need to showit as three row records instead of1 row in table2Do both first_date and second_date have to fall between old_date and new_date, or is it enough if either one does?
    What do you want to see on those 3 rows?
    Depending on your data and your requirements, here's one way:
    WITH     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL     <= 3
    SELECT  t2.*
    FROM          table2     t2
    CROSS JOIN     cntr
    WHERE   EXISTS (
    '              SELECT  1
                  FROM    table1     t1
                  WHERE   t1.first_date     BETWEEN t2.old_date AND t2.new_date
                  OR         t1.second_date     BETWEEN t2.old_date AND t2.new_date
    ;I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements) for both tables, and the results you want from that data.
    Include examples of any special situations you need to handle, such as the same row in table2 matching several rows in table1.
    See the forum FAQ {message:id=9360002}

  • Automatic break of row in a table when content is too large to fit on one page?

    The content in some of the cells of a table is larger than the maximum space available on the page, with the result that the content at the bottom of the cell is not visible.  How do I tell Pages to automatically break the row to continue on the next page?  I also notice that Pages pushes a row to the following page when the content won't fit on the page with other rows but does so on a page of it's own.  How do I tell Pages not to do that?  I suspect it would be the same command, but I haven't found it yet.  I can do this on Word....
    I suppose I could manually cut the "offending" paragraphs and manually paste them into the next page, but I would rather have Pages do this for me as the content is being edited and so the quantity of material in cells are changing.
    I hope I am intelligible enough for you to undertand what I'm trying to do.  I'm running Pages 2009, if that matters.
    Thanks for any help you can offer.

    O,
    That's the way tables work in iWork. No option for automatic break within a cell/row. As you guessed, it's your responsibility to fix it manualy. Sometimes you can downsize the font or increase the column width to gain some room for your content. If you want constant format, you've got to do the manual breakup.
    I'll add that Tables aren't always the best container for your material. I know that it's a comfortable look and feel, but when a row takes up a whole page, it may be time to rethink the design.
    Jerry

  • How do I make a one row table across several pages?

    Hi,
    I would like to create a one row two columns table, but to have this table with text flow on several pages.
    But I don't know how to do this. If I enter many lines of text, the table will not go on next page, and the extra lines are lost somewhere in the void.
    I can do this in NeoOffice though, and in MS Office too.
    Thanks

    Hello Julien,
    yes, I believe I can help your brother with a solution. First set your document to a two column layout in the layout inspector in the "Layout" tab panel. It's good to see the layout guides and hidden signs for better layout creation, so make them visible (menus: "View/Show Layout" and "View/Show Invisibles". To have an appropriate distance between the the rows of text, set the number field "After" at the bottom of the same panel to a value so the distance is ca. 1,5 line spacing or whatever your brother like to have.
    Now write the text you want to have in the left column. To place the translation in the right column, choose the menu item "Insert/Column Break". Now the text cursor jumps into the right column and you can write the translation. To type the new text in the left column, choose the menu item "Insert/Layout Break". The text cursor jumps from the end of the right text under the text in the left column, and you can go on.
    I know that the use of the menu items is not good for the workflow, so do the following:
    Open the Sytem Preferences and choose the panel "Keyboard & Mouse". There click the tab button "Keyboard Shortcuts". Press the "+" button at the bottom of the list field. In the appearing sheed select the Pages app in the pull-down menu "Application:". If you can't find it there, use the last menu item "Other..." to search for it. Now type the EXACT menu item title in the text field "Menu Title:". Here it is "Column Break". Than activate the field "Keyboard Shortcut" and press the key combo you want to have for this function like "optionshiftc" or whatever. Press the "Add" button and repeat this steps for the menu item "Layout Break".
    Close the System Preferences and start Pages. Now you can use the key combos for the break insertions.
    I hope whith this your brother gets the document he wants to have. But if there are more questions, feel free to post them here.

  • Only one row appendable at a time in alv

    I would like to limit only one blank row at a time in my alv grid. Means, if i append a row using the standard "Append Row" Button, the user should not be able to append a second blank row till he fills out the first one.
    Any hints ??
    regards,
    Priyank

    Hi Sascha,
    Thanks for the reply but it does not work.
    i put some code in the ...AFTER event, but it seems it is not executed on clicking the append button. I set a breakpoint there but it did not break.
    any other suggestions?
    my main problem is that when i append multiple rows in the alv and subsequently save the data from this alv grid, somehow one field is getting cleared and not holding the value the user has entered. for example, if i add 5 rows and then put data in these rows and save it, second row shows an initial value for a date field in the table. rest of the rows hold the correct value.  i don't know if it is a webdynpro bug or my mistake...i tried redoing everything but to no avail...same problem everywhere.
    thus i m trying to restrict the user to one row at a time only. it will be ideal if i can somehow solve the original problem. if not, even restricting to one row will be good enough.
    regards,
    Priyank

  • How can I have one row for each object?

    Post Author: farnaz
    CA Forum: WebIntelligence Reporting
    I have 3 objcts that one of them is ID and second one is internal code and the third one is quantity.There is more than one value for each ID (becouse of internal code).I want to create a report based on ID and quantity (not based on internal code).I make a break on ID but the result shows me more than one row for each ID.so how can i have just one row for each ID?
    another question:
    how can I post screen shot of the results to my messag in forum?

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    farnaz:
    Have you tried to omit "internal code" from your grid?  In normal circumstances, if you have "ID" and "Quantity" on the grid, then WebI will on its own summarize Quantity based on ID, however, this is provided that Quantity has been set up as a measure (or metric).  The quickest way to tell if Quantity is a metric or not is to observe the color of its icon when you look at it in the data panel.  If it is a purple (or sometimes appears as pink or fuscia) dot, then it's a measure, but if it is a blue box then it is a dimension.  If you need Quantity as a measure then this will have to be modified at the universe (make it look like "sum(Quantity)" in the select phase of the object, and insure the object is defined as a number....

  • Single row subquery Returning more than one row

    Hi,
    This is urgent.............
    could u any one please suggest me on this query it returning single row subquey returnin more than one row
    In this 2nd suquery fails some of the order_numbers returning more than price_list based on dates and in that situvation also my query has to successfull
    fro that i added this condition l.ordered_quantity between trunc(product_attr_value_from) and (product_attr_value_to) for that condition also failing this query
    pls give me the correct condition to approach this solution
    select
    substr(party.party_name,1,13),
    c.account_number,
    substr(h.order_number||'-'||l.line_number||'-'||l.shipment_number,1,15),
    q.name,l.unit_selling_price,
    (select qll.operand
    apps.qp_list_headers qlh,
    apps.qp_list_lines qll,
    apps.qp_list_lines qllx
    apps.qp_pricing_attributes qpa,
    apps.qp_rltd_modifiers qrm,
    apps.mtl_system_items msi
    wherer qll.list_header_id=qlh.list_header_id
    and qpa.list_header_id=qlh.list_header_id
    and qpa.list_line_id=qll.list_line_id
    and qrm.rltd_modifier_grp_type='PRICE BREAK'
    and qll.list_line_id=qrm.to_rltd_modifier_id
    and qll.list_line_type_code='PLL'
    and qllx.list_header_id=qlh.lsit_header_id
    and qllx.list_line_id=qrm.from_rltd_modifier_id
    and qllx.list_line_type_code='PBH'
    and qlh.list_header_id=l.price_list_id
    and qpa.product_attr_value=msi.inventory_item_id
    and qpa.product_attr_value=l.inventory_item_id
    and msi.segment2 is null
    and msi.organization_id=89
    and trunc(l.request_date) between trunc(qllx.start_date_active) and trunc(nvl(qllx.end_date_active,sysdate))
    and l_ordered_quantity between qpa.pricing_attr_value_from and qpa.pricing_attr_value_to
    and qpa.product_uom_code=l.pricing_quantity_uom),
    substr(l.ordered_item,1,13),
    u.user_name,
    t.name,
    l.ordered_quantity,
    l.creation_date,
    l.request_date,
    l.pricing_date,
    l.flow_status_code
    from apps.oe_order_headers_all h,
    hz_cust_Accounts c,
    hz_parties party,
    apps.oe_order_lines_all l,
    apps.qp_list_headers_tl q,
    apps.qp_list_headers_b qb,
    apps.fnd_user u,
    apps.so_order_types_all t
    where h.header_id=l.header_id
    and h.sold_to_org_id=c.cust_account_id
    and c.party_id=party.party_id
    and trunc(l.request_date)!=trunc(l.pricing_date)
    and qb.attribute1='Q'
    and q.list_header_id=qb.list_header_id
    and l.price_list_id=q.list_header_id
    and l.flow_status_code=!='CANCELLED'
    AND t.name!='ECOM'
    and t.name!='RMA'
    and l.open_flag='Y'
    and l.item_type_code='MODEL'
    and u.user_id=l.created_by
    and t.order_type_id=h.order_type_id
    and u.user_name='XXCONVERSION'
    and (l.unit_selling_price -
    (select qll.operand
    from apps.qp_list_headers qlh,
    apps.qp_lsit_lines qll,
    apps.qp_list_lines qllx,
    apps.qp_pricing_attributes qpa,
    apps.qp_rltd_modifiers qrm,
    apps.mtl_system_items msi
    where qll.list_header_id=qlh.list_header_id
    and qpa.list_header_id=qlh.lsit_header_id
    and qpa.list_line_id=qll.list_line_id
    and qrm.rltd_modifier_grp_type='PRICE BREAK'
    AND qll.list_line_id=qrm.to_rltd_modifier_id
    and qll.list_line_type_code='PLL'
    and qllx.list_header_id=qlh.list_header_id
    and qllx.list_line_id=qrm.from_rltd_modifier_id
    and qllx.list_line_type_code='PBH'
    and qlh.list_header_id=l.price_list_id
    and qpa.product_attr_value=msi.inventory_item_id
    and qpa.product_Attr_value=l.inventory_item_id
    and msi.segmetn2 is null
    and msi.organization_id=89
    trunc(l.request_date) between trunc(qllx.start_date_active) and trunc(nvl(qllx.end_date_active,sysdate)) and
    and l.ordered_quantity between qpa.pricing_attr_value_from and qpa.pricing_attr_value_to
    and qpa.product_uom_code=l.pricing_quantity_uom)!=0)
    order by creation_date

    Hi,
    995631 wrote:
    Hi,
    This is urgent.............Then don't use this forum.
    could u any one please suggest me on this query it returning single row subquey returnin more than one row
    In this 2nd suquery fails some of the order_numbers returning more than price_list based on dates and in that situvation also my query has to successfullRemember, none of the people who want to help you are as familiar with your application as you are, so you have to explain things that are obvious to you.
    What does "sucessful" mean in this case? Does is mean producing the right results? What are the right results? How can you tell them apart from the wrong results?
    As the errror message says, the (immediate) problem is that a single-row sub-query is returning more than a single row. If the sub-query tries to bring back more than 1 row, which one do you want to use? Or do you want to use some kind of aggregate, such as the average, which might not be the same as any of them?
    Whenever you have a problem, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Simplify the problem as much as possible. For example, remove all columns and tables that have nothing to do with the part you don't know how to do.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}

  • Passing one row of a query to a function

    I want to pass a query into a function one row at a time in
    the same way you could pass an array to a function one row at a
    time. I've read that queries are just CF structures under the hood
    so I believe it should be possible. I just don't know the syntax to
    reference a single query row (and all it's variables).
    I don't want to pass the whole query to the variable because
    I would like to do the looping outside the function. The idea is to
    simplify and standardize the formatting and arrangement of several
    variables (columns) in a UDF and keep the syntax to use the
    function simple. Therefore, I'd like to avoid having to do stuff
    like convert the query to an array. That would defeat the goal of
    keeping it simple.
    Thanks
    Magnus

    > myQuery.getRow(), but
    > using undocumented functions make me nervous.
    I absolutely agree, as a standard "caveat emptor" sort of
    thing. Which is
    a shame because there's a wealth of functionality "under the
    hood" which is
    far more useful than the "official" approach to things.
    To be honest, I treat the whole "that stuff is 'not
    supported'" and "it
    could change in future versions" thing with a liberal amount
    of salt.
    1) I didn't find the support from Macromedia very accessible
    in the first
    place, and have no reason to think it will be any different
    with Adobe.
    Other than in emergencies (that'd be once, in eight years), I
    have never
    used official support;
    2) I've been watching a lot of the "undocumented" stuff for a
    few versions
    (like since 6.1), and it all still works;
    3) I've had more problem with "fixes" to CFML issues breaking
    workarounds
    of the same than I have with using undocumented code.
    Obviously that's
    because I have 1000 lines of "normal" code to every line of
    "undocumented"
    code I use, but still.
    Basically when one changes version of software, there's a
    chance your code
    will stop working. It doesn't seem any more risky to me to
    use
    undocumented features than documented ones.
    Food for thought, if nothing else.
    Adam

  • Content Conversion: One row with one header and multiple item structures. Possible?

    Dear all,
    I have a input that looks like this:
    HeaderKeySomeHeaderInformationItemKeySomeItemInformationItemKeySomeItemInformation...
    Here's the actual input
    TEHGMESS0026000000288S0001TEI2____026200006112410400000000           18010000000000                                                      00126000000000126000120600000000002000000000                                    000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000JTEI2____026200006112410400000000           19010000000000                                                      00126000000000126000120600000000002000000000                                    000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
    HeaderKey = TEHGMESS
    ItemKey = TEI2____
    Is it possible to process this via MessageTransformBean (my actual scenario is JMS to IDoc)? I already tried but I only succeeded when having new lines in my input to separate between Header and (multiple) Items.
    So when the input and my configuration looks like below it works, but when I only have a single row input it doesn't work, even when specifying xml.recordHeader.endSeparator = '0' / xml.recordItem.endSeparator = '0'. I even tried xml.endSeparator = '0' but no luck.
    Input that works
    TEHGMESS0026000000288S0001
    TEI2____026200006112410400000000           18010000000000                                                      00126000000000126000120600000000002000000000                                    000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
    TEI2____026200006112410400000000           19010000000000                                                      00126000000000126000120600000000002000000000                                    000WESTMONOBERTBE2014052309422408120003 000000000000000000000000000000J
    Matching configuration that works for input which structures are delimited by new line.
    Paramentername
    Parametervalue
    Transform.Class
    com.sap.aii.messaging.adapter.Conversion
    Transform.ContentType
    text/xml;charset=utf-8
    xml.conversionType
    StructPlain2XML
    xml.documentName
    MT_TEI2Split
    xml.documentNamespace
    http://hansgrohe.com/pi/MQ/TEI2/10
    xml.keyFieldName
    SATZARTKey
    xml.keyFieldType
    CaseSensitiveString
    xml.processFieldNames
    fromConfiguration
    xml.recordHeader.fieldFixedLengths
    8,4,9,1,4
    xml.recordHeader.fieldNames
    SATZARTKey,SATZLENHG,NUTZLEN,MESSAE,MESSNR
    xml.recordHeader.keyFieldValue
    TEHGMESS
    xml.recordItem.fieldFixedLengths
    8,4,2,10,8,19,3,3,2,10,6,2,10,6,2,10,6,6,6,6,6,11,9,2,10,6,2,10,6,3,4,3,7,14,8,1,31
    xml.recordItem.fieldNames
    SATZARTKey,SATZLEN,BUCHART,TRNR,ANDGNR,MITEM,TEIVARI,BSTSTATU,REFTYP,ORNO,POS,REFTYP1,ORNO1,POS1,CHATYP,CHARGE,CHAPOS,ABBVONL,ABBNACH,ZUBVONL,ZUBNACH,I2MENG,I2BUNR,REFTYPN,ORNON,POSN,REFTYP1N,ORNO1N,POS1N,BSTSTATN,ABUSERAB,ABUSERFN,ABUSERNA,I2TIME,I2LIDNR,I2FMCODE,FILLER
    xml.recordItem.keyFieldValue
    TEI2____
    xml.recordsetName
    records
    xml.recordsetStructure
    recordHeader,1,recordItem,*
    Any clues on this? Is it even possible to have multiple structures in one row? Many thanks in advance
    Jens

    SAP came back to me with this answer:
    First, I would like to point the documentation for Message Transform
    Bean (MTB) in 7.4:
    http://help.sap.com/saphelp_nw74/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm?frameset=/en/57/0b2c4142aef623e10000000a155106/frameset.htm&current_toc=/en/45/0ea2de423c2d6be10000000a11466f/plain.htm&node_id=18
    As it is written at the beginning of this document, MTB is used to
    call classes written for the Plain Adapter Engine. So you may find
    additional documentation about the parameters for convertion in the
    documentation of the Plain Adapter Engine
    (http://help.sap.com/saphelp_nw74/helpdata/en/0d/00453c91f37151e10000000a11402f/content.htm?frameset=/en/1b/d5ef3b1ad56d4fe10000000a114084/frameset.htm&current_toc=/en/75/246b3de666930fe10000000a114084/plain.htm&node_id=11).There it is written that the structures by default are
    arranged line-by-line. The endSeparator just adds additional character
    string as a separator after the last column in a row.
    I hope that this answers your question. MTB expects the data to be
    structured line by line.
    You may add a custom module, which transforms the message in the
    expected format.
    If you have a look at the second link there's even a more precise wording that multiple structures within one line are not supported:
    xml.NameA.endSeparator
    Even if no specification is made here, a line break must follow since substructures are always expected as a line of the document.
    Bottom line is that it's not supported by now and verfied by me with PI 7.4 SP5
    Many thanks to Ambrish, Amit and Hareesh for the valuable input. Will probably try to work things out for now following Ambrish's / Hareesh's suggestion as this seems easier to implement. Amit's proposal with a dedicated module however would probably be the more polished solution.
    Cheers
    Jens

  • How to return one ROW with Multiple value seperated by Colon in a SQL Query

    Hi,
    I have a SQL query as mentioned.
    select deptno
      from deptI want to mofidfy this query, so that this should return me department list with colon delimeted in one ROW.
    10:20:30:40.......Thanks,
    Deepak

    In 10g:
    select rtrim(xmlagg(xmlparse(content deptno || ':')).getstringval(), ':') data
    from   dept;
    DATA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
    10:20:30:40with apologies for the abuse of XML...

  • How to Plot number and string in one row (data logger counter via MODBUS) ?

    hi all i made data log quantity using Digital Counter via modbus (RS-485) to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Solved!
    Go to Solution.
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Hi rhiesnand,
    right now you add 2 new rows to your array.
    The solution is to concatenate both row parts to one bigger 1D array before adding that array as new row to your 2D array!
    Like this:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to Plot number and string in one row (data logger counter) ?

    hi all i made data log quantity using Digital Counter via modbus to monitoring quantity and reject that has and Name Operator, Machine and Part Number.
    i have problem about plot the number & string in one row, as shown on the picture below :
    how to move that string on one row ? i attach my vi.
    Thanks~
    Attachments:
    MODBUS LIB Counter.vi ‏39 KB

    Duplicate and answered - http://forums.ni.com/t5/LabVIEW/How-to-Plot-number-and-string-in-one-row-data-logger-counter-via/m-p...

  • Grouping all in one row

    Hi guys, I got a black out. I got this situation:
    Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int) insert into forum values ('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0), ('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0), ('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0), ('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0), ('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0), ('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0), ('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440), ('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640), ('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
    I had to run a huge union all taking data fro ACons, BCons, CCons, no way to do link or other stuff, we're talking about millions rows, different servers..anyway. I got this situation. Now I need an output like:
    Buenos Aires 1 2014 100 330 300
    Toronto  1 2014  400 1100 640
    Pratically Icity, Imonth, Iyear, Acons, Bcons, Ccons in one rows and not in three difefrent rows. I already did this stuff a lot of time but I'm going underpressure by another side ( a Cube that doesn't update correctly).
    Any suggestion? Thanks everyone.

    Are you looking for the below? If not, please let us know:
    Create table Forum ( Icity varchar(50), IMonth int, Iyear int, ACons int, BCons int, CCons int)
    insert into forum values
    ('Buenos Aires',1,2014,100,0,0), ('Buenos Aires',2,2014,140,0,0),
    ('Buenos Aires',3,2014,60,0,0), ('Toronto',1,2014,400,0,0),
    ('Toronto',2,2014,625,0,0), ('Toronto',3,2014,880,0,0),
    ('Buenos Aires',1,2014,0,330,0), ('Buenos Aires',2,2014,0,1230,0),
    ('Buenos Aires',3,2014,0,470,0), ('Toronto',1,2014,0,1100,0),
    ('Toronto',2,2014,0,1520,0), ('Toronto',3,2014,0,400,0),
    ('Buenos Aires',1,2014,0,0,300),('Buenos Aires',2,2014,0,0,440),
    ('Buenos Aires',3,2014,0,0,1080), ('Toronto',1,2014,0,0,640),
    ('Toronto',2,2014,0,0,1020), ('Toronto',3,2014,0,0,880)
    Select Icity,IMonth,Iyear,MAX(ACons),MAX(BCons),MAX(cCons) From Forum
    Group by Icity,IMonth,Iyear
    Drop table Forum

  • Multiple record in one row..

    Hi experts,
    I want to merge multiple row from same table into one row... is it possible? if so then how??
    Regards,
    SKP

    Sure, it's possible
    create table scott.a
    as
    select 1 a, 2 b from dual     
    union all
    select 3 a, 4 b from dual     
    create table scott.b
    (a number, b number, c number, d number)
    insert into scott.b
    select a1.a,a1.b,a2.a,a2.b from scott.a a1, scott.a a2
    where a1.a = 1 and a2.a = 3
    P.S. Sorry, at first misunderstood the task
    Message was edited by:
    Dmytro Dekhtyaryuk

  • Display results in one row

    Query below is returning data in multiple rows, I want to display them as one row:
    select
    event_id,
    data_type_cd,
    quantity
    from Event,Data_types
    where event_id = 1234
    and event.DATA_TYPE_ID = data_types.DATA_TYPE_ID
    (I want to display data_type_cd concatenated with quantity as every code had different quantity)

      > Sample data is:
      > Data_type_id Quantity
      > ------------------ ----------
      > 1 34
      > 2 67
      > 15 35
      > 20 23
      > I want to display as:
      > 1 34 2 67 15 35 20 23
    if you want all the rows in one column see this given example below:
      SQL> select t.*
        2    from (select  1 data_type_id, 34 quantity from dual union all
        3          select  2 data_type_id, 67 quantity from dual union all
        4          select 15 data_type_id, 35 quantity from dual union all
        5          select 20 data_type_id, 23 quantity from dual) t;
      DATA_TYPE_ID   QUANTITY
                 1         34
                 2         67
                15         35
                20         23
      SQL> select substr(sys_xmlagg(xmlelement(col, ' ' || data_type_id||' '||quantity)).extract('/ROWSET/COL/text()').getclobval(), 2) new_disp
        2    from (select  1 data_type_id, 34 quantity from dual union all
        3          select  2 data_type_id, 67 quantity from dual union all
        4          select 15 data_type_id, 35 quantity from dual union all
        5          select 20 data_type_id, 23 quantity from dual) t;
      NEW_DISP
      1 34 2 67 15 35 20 23
      SQL>

Maybe you are looking for