Group rows in column

Hi all,
I desperately need help on the below scenario.
I have a Emp table that have records as below
SQL> Select * from Emp;
Name          Loc
Jack          NWK
Jill          BOS
Tom          Iwa
Jack          Jry
Tom          Wiz
Sam          Aus
Jill          Mia
The output should be like
SQL> Select * from Emp;
Name          Loc
Jack          NWK, Jry
Jill          BOS, Mia
Tom          Iwa, Wiz
Please somebody can help me in writing this query.
Also I would be grateful if somebody and show me alignment for the above text
Thanks and Regards
Saaz

Formatting code on the forum...
Surround the code with either...
[code]
... code ...
[/code]
or
[pre]
... code ...
[/pre]
The "code" tags maintain blank lines but don't allow other formatting such as bold/italic etc., whilst the "pre" tags will strip out blank lines on some browsers (e.g. Internet Explorer) but allow other formatting tags to be used as well.
Also look at... http://www.oracle.com/technology/forums/faq.html#q14

Similar Messages

  • Advanced datagrid with grouped columns and grouped rows

    hello every body, plz need your experience help. 'cause Im so new using FLEX
    I have an XML (like an XML data type) something like this
    <Table>
      <Rows>
        <cAgencia>F0002</cAgencia>
        <cAgNombre>SanBorja</cAgNombre>
        <cTVentanilla>V0002</cTVentanilla>
        <dTVNombre>Plataforma</dTVNombre>
        <TcksEnEspera>20</TcksEnEspera>
        <VentsEnAtencion>50</VentsEnAtencion>
      </Rows>
      <Rows>
         <cAgencia>F0003</cAgencia>
         <cAgNombre>Miraflores</cAgNombre>
         <cTVentanilla>V0002</cTVentanilla>
         <dTVNombre>Plataforma</dTVNombre>
         <TcksEnEspera>30</TcksEnEspera>
         <VentsEnAtencion>40</VentsEnAtencion>
       </Rows>
      <Rows>
         <cAgencia>F0002</cAgencia>
         <cAgNombre>SanBorja</cAgNombre>
         <cTVentanilla>V0003</cTVentanilla>
         <dTVNombre>Caja</dTVNombre>
         <TcksEnEspera>55</TcksEnEspera>
         <VentsEnAtencion>25</VentsEnAtencion>
       </Rows>
       ...... (continue)
    </Table>
    so, I need to make a table (I guess with advancedDataGrid) something like this
    as you can see,   I have to group them by columns and Rows.  I have found a "mx:groupedColumns" that maybe could help me , but I couldn't find something like "mx:groupedRows".
    The grid may be dynamic,   for example if I have another XML node like:
      <Rows>
         <cAgencia>F0004</cAgencia>
         <cAgNombre>SanMiguel</cAgNombre>
         <cTVentanilla>V0002</cTVentanilla>
         <dTVNombre>Plataforma</dTVNombre>
         <TcksEnEspera>15</TcksEnEspera>
         <VentsEnAtencion>52</VentsEnAtencion>
       </Rows>
    the grid may add a ROW and in the column of plataforma add the data: 15 and 52, so the grid may be something like this:
    as you can see, the grid may add rows and columns in depends of the count of XML data.
    plz help.
    thanks, regards  from Lima, Peru.
    JS

    any help ????????? I found OLAPDataGrid .....   I was thinking to send all the data into a bidimensional Array , then pass the data of my bidimensionalArray to  OLAPDataGrid ...  but I'n not sure if Flex is able to do it  .... 
    the really serious problem is the special ROW I must use ...
    regards
    JS

  • Group by and then convert form Row to column

    Hi All,
    below is a transaction table for bank customer.
    region_id     cutomer_id     transaction_type     transaction_date
    101          12345          CC               10-March-2011
    101          12345          DC               07-March-2011
    101          12345          P1               01-March-2011
    101          12345          p2               10-Jan-2011
    102          45678          CC               15-feb-2011
    101          12345          p3               27-OCT-2010with combinaton of region_id and customer_id, we get uniq record from the table. There are also different kind of transaction a customer has done. It is given in transaction_type column (CC - Credit card, Dc - Debit Card, and those start with P% {including P1, p2, p3} = payment).
    Now my requirement is to get the number of transaction for each transaction type for a current year and also number of total transaction by the customer. Below is my output table.
    region_id     cutomer_id     transaction_type     transaction_date     Tran_type_cc     Tran_type_DC     Tran_type_P     count_tran
    101          12345          CC               10-March-2011          1          1          2          5
    101          12345          DC               07-March-2011          1          1          2          5
    101          12345          P1               01-March-2011          1          1          2          5
    101          12345          p2               10-Jan-2011          1          1          2          5
    102          45678          CC               15-feb-2011          1          0          0          1
    101          12345          p3               27-OCT-2010          1          1          2          5if i do group by it gives me result but at row level and to convert row into column to get above result, i need to use decode function. My sourcec is containing 25 miliion records, and if i execute the query, it is getting hanged. Can someone help me how can i write a fine tuned query by using analytical function

    How about this?
    Note: I suppose, p1, P1, p2, P2, p3, P3 all belong to the same payment category regardless of their upper/lower case.
    Here is the table and the data:
    CREATE TABLE T1 (REGION_ID NUMBER, CUSTOMER_ID NUMBER, TRAN_TYPE VARCHAR2(5), TRAN_DATE DATE);
    INSERT INTO T1 VALUES (101, 12345, 'CC', TO_DATE('10-Mar-2011','DD-MON-YYYY'));
    INSERT INTO T1 VALUES (101, 12345, 'DC', TO_DATE('07-Mar-2011','DD-MON-YYYY'));
    INSERT INTO T1 VALUES (101, 12345, 'P1', TO_DATE('01-Mar-2011','DD-MON-YYYY'));
    INSERT INTO T1 VALUES (101, 12345, 'p2', TO_DATE('10-Jan-2011','DD-MON-YYYY'));
    INSERT INTO T1 VALUES (102, 45678, 'CC', TO_DATE('15-FEB-2011','DD-MON-YYYY'));
    INSERT INTO T1 VALUES (101, 12345, 'p3', TO_DATE('27-OCT-2010','DD-MON-YYYY'));Here is the query:
    SELECT REGION_ID, CUSTOMER_ID, TRAN_TYPE, TRAN_DATE
      , SUM(DECODE(TRAN_TYPE, 'CC', '1','0')) OVER (PARTITION BY CUSTOMER_ID) AS CC
      , SUM(DECODE(TRAN_TYPE, 'DC', '1', '0')) OVER (PARTITION BY CUSTOMER_ID ) AS DC
      , SUM(DECODE(SUBSTR(UPPER(TRAN_TYPE), 1,1) , 'P', '1','0')) OVER (PARTITION BY CUSTOMER_ID) AS P
      , SUM(1) OVER (PARTITION BY CUSTOMER_ID) AS TRAN_T
    FROM T1 ;
    r_id   cust_id      t_TYPE   T_DATE  CC_CNT  DC_CNT  P_CNT  T_CNT
    101     12345     CC     10-MAR-11     1     1     3     5
    101     12345     DC     07-MAR-11     1     1     3     5
    101     12345     p3     27-OCT-10     1     1     3     5
    101     12345     p2     10-JAN-11     1     1     3     5
    101     12345     P1     01-MAR-11     1     1     3     5
    102     45678     CC     15-FEB-11     1     0     0     1Edited by: PhoenixBai on Mar 14, 2011 4:16 PM

  • Grouped rows\columns open up on each refresh

    Hi,
    Every time I refresh a smartview query the grouped rows & columns open up, Is there a view where I can avoid this ?
    Thanks

    Thanks a lot GlennS_3

  • How to hide itemRenderers in the Grouped rows of an AdvancedDataGrid?

    I am using an AdvancedDataGrid and showing a comboBox as the itemRenderer and also the editRenderer. However I am seeing the combobox in the grouped rows also. Below is the code I am using and also attached the screenshot of the app. Please help.
    TestAdvGridGrpRen.mxml
    ===================
    <?xml version="1.0"?>
    <!-- dpcontrols/adg/SummaryGroupADGCustomSummary.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
        <mx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.controls.advancedDataGridClasses.AdvancedDataGridColumn;
                import mx.collections.IViewCursor;   
                import mx.collections.SummaryObject;
    [Bindable]
    private var dpFlat:ArrayCollection = new ArrayCollection([
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
      {Region:"Southwest", Territory:"Arizona",
          Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000},
      {Region:"Southwest", Territory:"Central California",
          Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000},
      {Region:"Southwest", Territory:"Nevada",
          Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
      {Region:"Southwest", Territory:"Northern California",
          Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
      {Region:"Southwest", Territory:"Southern California",
          Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}
                // Callback function to create
                // the SummaryObject used to hold the summary data.
                private function summObjFunc():SummaryObject {
                    // Define the object containing the summary data.
                    var obj:SummaryObject = new SummaryObject();
                    // Add a field containing a value for the Territory_Rep column.
                    obj.Territory_Rep = "Alternating Reps";
                    return obj;
                // Callback function to summarizes
                // every other row of the Actual sales revenue for the territory.
                private function summFunc(cursor:IViewCursor, dataField:String,
                    operation:String):Number {
                    var oddCount:Number = 0;
                    var count:int = 1;
                    while (!cursor.afterLast)
                        if (count % 2 != 0)
                            oddCount += cursor.current["Actual"];
                        cursor.moveNext();
                        count++;
                    return oddCount;
          ]]>
        </mx:Script>
        <mx:AdvancedDataGrid id="myADG"
            width="100%" height="100%"
            initialize="gc.refresh();">      
            <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dpFlat}">
                    <mx:Grouping>
                       <mx:GroupingField name="Region"/>
                       <mx:GroupingField name="Territory">
                          <mx:summaries>
                             <mx:SummaryRow summaryObjectFunction="summObjFunc"
                                summaryPlacement="first">
                                <mx:fields>
                                   <mx:SummaryField dataField="Actual" summaryFunction="summFunc"/>
                                </mx:fields>
                             </mx:SummaryRow>
                          </mx:summaries>
                       </mx:GroupingField>
                    </mx:Grouping>
                </mx:GroupingCollection>
            </mx:dataProvider>      
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Region"/>
                <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                    headerText="Territory Rep"/>
                <mx:AdvancedDataGridColumn headerText="Actual" dataField="Actual"
                rendererIsEditor="true"
                itemRenderer="TestStatusTypeEditor"
                editorDataField="type"/>
                <mx:AdvancedDataGridColumn dataField="Estimate"/>
            </mx:columns>
       </mx:AdvancedDataGrid>
    </mx:Application>
    TestStatusTypeEditor.mxml
    ====================
    <?xml version="1.0" encoding="utf-8"?>
    <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml"
    creationComplete="OnInit()" >
    <!-- This is the content of the ComboBox.
    <mx:dataProvider>
    <mx:Object label="Cog" />
    <mx:Object label="Sproket" />
    </mx:dataProvider>
    -->
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
            [Bindable]
            public var cards:ArrayCollection = new ArrayCollection(
                [ {label:"38865", data:1},
                  {label:"29885", data:2},
                  {label:"29134", data:3},
                  {label:"52888", data:4},
                  {label:"38805", data:5},
                  {label:"55498", data:6},
                  {label:"44985", data:7},
                  {label:"44913", data:8}]);
    private function OnInit():void
    dataProvider = cards;
    * This override of set data compares the data.label against the label property
    * of each item in the dataProvider (above). This code is written a bit more
    * generically than necessary, but it would allow you to have a long list
    * in the dataProvider and not have to change this code.
    override public function set data(value:Object):void
    super.data = value;
    var list:ArrayCollection = dataProvider as ArrayCollection;
    for(var i:int=0; i < list.length; i++)
    if( String(value.statusName) == list[i].label ) {
    selectedIndex = i;
    * This getter is the one identified as the editorDataField in the list for
    * the itemEditor.
    public function get type() : String
    if( selectedItem ) {
    return selectedItem.label;
    else {
    return null;
    ]]>
    </mx:Script>
    </mx:ComboBox>

    Solved this issue by using mx:rendererProviders element for my AdvancedGrid. Using the depth parameter gives me the ability to hide the itemRenderer for the Grouped rows.
        <mx:AdvancedDataGrid id="myADG"
            width="100%" height="100%"
            initialize="gc.refresh();">       
            <mx:dataProvider>
                <mx:GroupingCollection id="gc" source="{dpFlat}">
                    <mx:Grouping>
                       <mx:GroupingField name="Region"/>
                       <mx:GroupingField name="Territory">
                          <mx:summaries>
                             <mx:SummaryRow summaryObjectFunction="summObjFunc"
                                summaryPlacement="first">
                                <mx:fields>
                                   <mx:SummaryField dataField="Actual" summaryFunction="summFunc"/>
                                </mx:fields>
                             </mx:SummaryRow>
                          </mx:summaries>
                       </mx:GroupingField>
                    </mx:Grouping>
                </mx:GroupingCollection>
            </mx:dataProvider>       
            <mx:columns>
                <mx:AdvancedDataGridColumn dataField="Region"/>
                <mx:AdvancedDataGridColumn dataField="Territory_Rep"
                    headerText="Territory Rep"/>
                <mx:AdvancedDataGridColumn headerText="Actual" dataField="Actual"
                rendererIsEditor="true"
                editorDataField="type"/>
                <mx:AdvancedDataGridColumn dataField="Estimate"/>
            </mx:columns>
    <mx:rendererProviders>
        <mx:AdvancedDataGridRendererProvider
            columnIndex="2"
            columnSpan="1"
            depth="3"
            renderer="TestStatusTypeEditor"/>
    </mx:rendererProviders>
       </mx:AdvancedDataGrid>

  • Creating a radio button group in a column of a table in Web Dynpro

    Hi,
    I want to put a radio button group in a column of a table in Webdynpro. I added a column to a web dynpro view and then inserted a tableCellEditor for that column.. But I cannot define it as Radio Button group. I want the user to be able to select 3 statuses using this group.
    Does anyone have a solution for this??
    Thanks in advance...
    Nakul

    Hi,
    You wont be able create three RB in one cell.
    Create as many column as the no of options is.Here it is 3.
    Create 4 attributes inside the node , option 1,option 2,option 3 and selectedoption.
    Map each RB s keytoSelect to option 1,2,3. Map all the RBs selectedKey atribute to selectedoption.
    Now selection for each row will be stored in the selected option.
    Regards
    Bharathwaj

  • Oracle 10g Rows to column

    Hi
    I have folowing scenario. I am getting the result with some query like below :
    STATE      DAY     AVG
    NY        02/02     5
    NY        02/03     10
    NY        02/04     20
    NY        02/05     15
    IL        02/02     23
    IL        02/03     34
    IL        02/04     29
    IL        02/05     9
    FL        02/02     15
    FL        02/03     8
    FL        02/04     9
    FL        02/05     10
    and so on..Now I want to convert it from rows to column, but still want to keep STATE column group by :
    so the result would be :
    STATE   02/02   02/03   02/04   02/05
    NY        5      10       20    15
    IL        23     34       29    9
    FL        15     8        9     10
    and so on...I tried using pivot function, but it didnt work. is it even possible? or I will have to do it in code (.net c#) side.
    Thanks

      1  WITH t AS (
      2  SELECT 'NY' state,'02/02' mydt,5 myavg FROM dual
      3  UNION all
      4  SELECT 'NY','02/03',10 FROM dual
      5  UNION all
      6  SELECT 'NY','02/04',20 FROM dual
      7  UNION all
      8  SELECT 'NY','02/05',15 FROM dual
      9  UNION all
    10  SELECT 'IL','02/02',23 FROM dual
    11  UNION all
    12  SELECT 'IL','02/03',34 FROM dual
    13  UNION all
    14  SELECT  'IL','02/04',29 FROM dual
    15  UNION all
    16  SELECT  'IL','02/05',9 FROM dual
    17  UNION all
    18  SELECT  'FL','02/02',15 FROM dual
    19  UNION all
    20  SELECT  'FL','02/03',8 FROM dual
    21  UNION all
    22  SELECT  'FL','02/04',9 FROM dual
    23  UNION all
    24  SELECT  'FL','02/05',10 FROM dual
    25  )
    26  SELECT * FROM t
    27  PIVOT
    28  (
    29  SUM(myavg)
    30  FOR mydt IN('02/02','02/03','02/04','02/05')
    31  )
    32* ORDER BY state DESC
    SQL> /
    ST    '02/02'    '02/03'    '02/04'    '02/05'
    NY          5         10         20         15
    IL         23         34         29          9
    FL         15          8          9         10Am I missing some thing here ?

  • Hide a row or column for characteristic value # in Query Designer

    Hi gurus,
    I would if we could hide a result row / column if one of the characteristic value is #. The requirement is actually to remove the meaningless row / column from the whole result set. For example, I have a char Material Group in the column. Since not every Material is assigned to a Material Group, I will get the following layout:
    Material_Group A
    Material_Group B
    Material_Group C
    Is it possible to define in query designer so that the column with # will automatically not be displayed?
    Thanks,
    Meng

    Hi Meng,
    I guess we have the same users..
    But there is one thing that is going to make a non sense on the report: if you do not display the "#" for material group, then the total of your query by material group will not be the summation of what is displayed on the screen...and if the user explort the information in Excel (pretty sure they will do so), you will have some calls that your query does not balance....
    Based on that assumption, tell the users to assign a material group to the materials, so that this unassigned column disappears. You could even give them a control report listing all the parts that do not have a material group
    If this is a standard business rule not to have a material group for all parts, then, what you could do is to change the text for empty rows for Material group, then the "#" will disappear and wil be under the text description you defined.
    But keep in mind that your data is made of materials which do not have a material group in their definition, noraml or not ?
    PY

  • Rows to column in 11g as single query

    I would like to create single row with column name
    as ISIN, CUSIP, SEDOL for each row which has desc IS, CU, SE
    as below
    SQL> select * from test;
          CODE DESCR                     VALUE
            10 IS                          100
            10 CU                          200
            10 SE                          200
            20 IS                          100
            20 CU                          200
            20 SE                          200
    The row should looks like below with column name ISIN, CUSIP, SEDOL
          CODE ISIN    CUSIP   SEDOL
            10 100     200      200
            20 100     200      200
    CREATE TABLE TEST
      CODE   NUMBER(10),
      DESCR  VARCHAR2(20 BYTE),
      VALUE  NUMBER(10)
    SET DEFINE OFF;
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (10, 'IS', 100);
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (10, 'CU', 200);
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (10, 'SE', 200);
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (20, 'IS', 100);
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (20, 'CU', 200);
    Insert into TEST
       (CODE, DESCR, VALUE)
    Values
       (20, 'SE', 200);
    COMMIT;

    Frank, the query i posted is an eg.
    in real i have 200k records in the table.
    SQL> explain plan for select * from master_base a, (SELECT  * FROM    id_xref
      2  PIVOT    (  max (SECURITY_XREF_NBR)
      3      FOR    SECURITY_XREF_CD
      4      IN    (    'IS'    AS isin
      5          ,    'CU'    AS cusip
      6          ,    'SD'    AS sedol
      7          )
      8      )
      9  ) b
    10  where a.security_nbr = b.security_nbr(+)
    11  ;
    Explained.
    Elapsed: 00:00:00.23
    SQL> set lines 200
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2437398092
    | Id  | Operation             | Name                    | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT      |                         |   238K|    57M|       |  7495   (2)| 00:01:30 |
    |*  1 |  HASH JOIN OUTER      |                         |   238K|    57M|  8024K|  7495   (2)| 00:01:30 |
    |   2 |   TABLE ACCESS FULL   |          MASTER_BASE | 61776 |  7299K|       |   825   (3)| 00:00:10 |
    |   3 |   VIEW                |                         |   238K|    29M|       |  4647   (2)| 00:00:56 |
    |   4 |    HASH GROUP BY PIVOT|                         |   238K|    15M|    21M|  4647   (2)| 00:00:56 |
    |   5 |     TABLE ACCESS FULL |     ID_XREF     |   238K|    15M|       |   706   (4)| 00:00:09 |
    PLAN_TABLE_OUTPUT
    Predicate Information (identified by operation id):
       1 - access("A"."sECURITY_NBR"="B"."SECURITY_NBR"(+))
    17 rows selected.Edited by: user520824 on Jul 22, 2010 8:28 AM
    Edited by: user520824 on Jul 22, 2010 8:31 AM

  • Rows to column and need to nvl for that newly  columns

    Hi,
    I have to create  rows to column query in rdf and in turn i have  to created excel rtf template to produce excel output.
    select max(decode (test.role, 'PA-ELT Member', test.full_name )) ELT_MEMBER,
    max(decode (test.role, 'PA-IT Director', test.full_name )) IT_MEMBER,
    max(decode (test.role, 'Project Manager', test.full_name )) Project_Manager,
    TEST.segment1 project_NUMber,
    test.name project_Name,
    test.project_id,
    test.project_type ,
    test.organization_name,
    TEST.project_status_name Status_Name,
    TEST.start_date Start_date,
    TEST.COMPLETION_DATE,
    TEST.Planned_OOE,
    TEST.Planned_Dep,
    TEST.Planned_lab
      from
    (select
    pppv.full_name,
    pppv.role,
    ppa.name,
    ppa.project_id,
    ppa.segment1, 
    ppa.project_type,
    (select name from PA_ALL_ORG_V  where organization_id = ppa.CARRYING_OUT_ORGANIZATION_ID) organization_name,
    ppa.PROJECT_STATUS_CODE,
    pps.PROJECT_STATUS_NAME,
    ppa.START_DATE,
    ppa.COMPLETION_DATE,
    (select N_EXT_ATTR1 from PA_PROJECTS_ERP_EXT_B where project_id = ppa.project_id and ATTR_GROUP_ID = 243) Planned_OOE,
    (select N_EXT_ATTR2 from PA_PROJECTS_ERP_EXT_B where project_id = ppa.project_id and ATTR_GROUP_ID = 243) Planned_Dep,
    (select N_EXT_ATTR3 from PA_PROJECTS_ERP_EXT_B where project_id = ppa.project_id and ATTR_GROUP_ID = 243) Planned_lab
    from
    PA_PROJECTS_ALL ppa, PA_PROJECT_PLAYERS_V pppv, pa_project_statuses pps
    where ppa.project_id = pppv.project_id
    and ppa.PROJECT_STATUS_CODE = pps.PROJECT_STATUS_CODE
    and pppv.role in ('PA-ELT Member','PA-IT Director','Project Manager')
    and ppa.CARRYING_OUT_ORGANIZATION_ID=3994
    )test
    where  1=1
    and TEST.project_type = nvl(:P_PROJECT_TYPE,test.project_type)
    and TEST.project_status_name = nvl(:P_PROJECT_STATUS,test.project_status_name)
    and TEST.segment1 = nvl(:P_PROJECT_NUMBER,test.segment1)
    and TEST.full_name = nvl(:P_ELT_MEMBER, test.full_name)
    and test.full_name = nvl(:P_IT_DIRECTOR,test.full_name)
    and TEST.full_name = nvl(:P_PROJECT_MANAGER,test.full_name)
    group by 
    TEST.segment1,
    test.name,
    test.project_id,
    test.project_type,
    test.organization_name,
    TEST.project_status_name,
    TEST.start_date,
    TEST.COMPLETION_DATE,
    TEST.Planned_OOE,
    TEST.Planned_Dep,
    TEST.Planned_lab
    order by TEST.SEGMENT1
    see ELT_MEMBER,IT_MEMBER and Project_Manager  are columns created from rows to column.
    now if i put where clause for this any columns for Eg: ELT_MEMBER it is giving Elt_member column values alone not remaining IT_member  and Project Manager it show null even it has values .
    it is because of this where clause
    and TEST.full_name = nvl(:P_ELT_MEMBER, test.full_name)
    and test.full_name = nvl(:P_IT_DIRECTOR,test.full_name)
    and TEST.full_name = nvl(:P_PROJECT_MANAGER,test.full_name)
    though i have ELT_MEMBER, IT_member and Project Manager column in where clause i have to call parent sql query column full_name.
    i have tried to have nvl on column like below.
    nvl( max(decode (test.role, 'Project Manager', test.full_name )),(select full_name from PA_PROJECT_PLAYERS_V where project_id = test.project_id and role ='Project Manager')) Project_Manager,
    but it is showing error single -row subquery error .
    it is possible to have a where clause for rows to columns .
    Please help in this regards

    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 'john,henry,michi,glen' as customer_name, 25000 as credit_limit from dual union all
      2             select 'dilon,bryan', 10000 from dual union all
      3             select 'raymond', 8000 from dual)
      4  -- END OF TEST DATA
      5  select regexp_substr(customer_name, '[^,]+', 1, rn) as customer_name, credit_limit
      6  from   t
      7        ,(select rownum rn
      8          from dual
      9          connect by rownum <= (select max(length(regexp_replace(t.customer_name,'[^,]'))+1) from t))
    10  where regexp_substr(customer_name, '[^,]+', 1, rn) is not null
    11* order by credit_limit desc
    SQL> /
    CUSTOMER_NAME         CREDIT_LIMIT
    john                         25000
    henry                        25000
    michi                        25000
    glen                         25000
    bryan                        10000
    dilon                        10000
    raymond                       8000
    7 rows selected.
    SQL>Just replace "t" with your query to select the data from the external table.

  • Converting rows to columns using dynamic query.

    I am trying to use the below code that I founnd on the web to conver rows to columns. the reason that I want to use dynamic query is that the number of rows are not know and changes.
    declare
        lv_sql varchar2(32767) := null ;
    begin
        lv_sql := 'SELECT Iplineno ';
        for lv_rec in (SELECT distinct vendor from bidtabs  where letting = '10021200' and call ='021')
        loop
            lv_sql :=   lv_sql
                        || CHR(10)
                        || ', MAX( DECODE( vendor, '
                        || chr(39)
                        || lv_rec.vendor
                        || CHR(39)
                        || ', bidprice, NULL ) ) as "'
                        || lv_rec.vendor
                        || '" ' ;
        end loop;
        lv_sql :=   lv_sql
                    || CHR(10)
                    || 'FROM bidtabs  where letting =  ''10021200''  and call =  ''021''  and lineflag = ''L''  '
                    || CHR(10)
                    || 'GROUP BY iplineno ;' ;
    here is the result
    BIDPRICE     CALL     IPLINENO     LETTING     VENDOR
    9,585     021     0010     10021200     C0104        
    1,000     021     0020     10021200     C0104        
    1,000     021     0030     10021200     C0104        
    17     021     0040     10021200     C0104        
    5     021     0050     10021200     C0104        
    11,420     021     0010     10021200     K0054        
    1,100     021     0020     10021200     K0054        
    1,100     021     0030     10021200     K0054        
    5     021     0040     10021200     K0054        
    3     021     0050     10021200     K0054        
    8,010     021     0010     10021200     V070         
    900     021     0020     10021200     V070         
    1,320     021     0030     10021200     V070         
    11     021     0040     10021200     V070         
    3     021     0050     10021200     V070         
    and here is the desired output
    CALL     IPLINENO     LETTING      C0104              K0054              V070         
    021     0010     10021200      9,585                     11,420                                   8,010
    021     0020     10021200      1,000       1,100     900
    021     0030     10021200      1,000     1,100     1,320
    021     0040     10021200       17     5     11
    021     0050     10021200      5     3     3

    Here is the error message I am getting:
    RA-06550: line 22, column 43:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    pipe

  • Row to column mapping and  combining columns

    Hi
    I have one issue i want to concatenating some columns and map row as columns like below.I am giving one ex and have more than 1000 employees like this
    Example
    {Srno  Eno Ename job datestart}
    {1 01 jack------clerk------01-Jan-2008}
    { 2         01   jack-----snrclerk----01-Jun-2009}
    { 3         01    jack ---- officer------- 01-Jan-2010}
    I want to display the row to columan mapping like first row concatenated as col2 and second row for col2 column etc
    {eMpno------- col1 ------------------co12----------------------------------col3}
    {0101 jackclerk 01-Jan-2008---jacksnrclerk01-Jun-2009------01jackofficer01-Jan-2010}
    rgds
    ramya
    Edited by: user11243021 on Sep 7, 2010 5:21 AM

    with t as (
               select 1 srno,'01' eno,'jack' ename,'clerk' job,to_date('01-Jan-2008','dd-mon-yyyy') datestart from dual union all
               select 2 srno,'01' eno,'jack' ename,'snrclerk' job,to_date('01-Jun-2009','dd-mon-yyyy') datestart from dual union all
               select 3 srno,'01' eno,'jack' ename,'officer' job,to_date('01-Jan-2010','dd-mon-yyyy') datestart from dual
              ) -- end of data sample
    select  eno,
            max(
                case srno
                  when 1 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col1,
            max(
                case srno
                  when 2 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col2,
            max(
                case srno
                  when 3 then ename || ' ' || job || to_char(datestart,' dd-Mon-yyyy')
                end
               ) col3
      from  t
      group by eno
    EN COL1                      COL2                      COL3
    01 jack clerk 01-Jan-2008    jack snrclerk 01-Jun-2009 jack officer 01-Jan-2010
    SQL> SY.

  • How to convert row into column

    Hi All,
    My oracle apps version is r12 and db is 10 and i am using Bi publisher version 10g.
    Is it possible to convert row into column in Rtf template,
    My Query is
    SELECT distinct pvs.vendor_site_code,sum(aia.invoice_amount)
    FROM ap_invoices_all aia, po_vendors po, po_vendor_sites_all pvs
    WHERE aia.org_id = pvs.org_id
    AND aia.vendor_id = po.vendor_id
    AND aia.vendor_site_id = pvs.vendor_site_id
    AND aia.org_id=204
    group by pvs.vendor_site_code
    And output is like this
    Vendor sitecode Invoiceamt
    EAM-ERS 79240
    STAR GATE - PAY 3245902.31
    UPS - HQ 10792040.9
    Like this
    So in template i need the output like this
    Vendor sitecode EAM-ERS STAR GATE - PAY UPS - HQ
    Invoiceamt 79240 3245902.31 10792040.9
    I tried to achieve the output using sql query but by hardcoding only i have achieved it, so i have tried to convert directly in RTF template.
    can any one tell me is it possible.
    And if new project is added from the front end ie(now the query will produce 4 rows but now in template i have created only three columns)
    Is it possible to add a new column dynamically.
    Can any one please guide me and tell me is there any example.
    Thanks & regards
    Srikkanth

    Take a look at this post: http://blogs.oracle.com/roller-ui/bsc/spider.jsp?entry=MT%3aENTRY%3a5001
    Thanks,
    Bipuser

  • Totals in Row and column

    I have a requirement in report,
    It should display totals in row and column wise,
    Group open     Close     Total     
    A     10     5     15     
    B     15     10     25
    Total     25     15     40
    Thanks,
    Srini

    Send me the template and xml file to [email protected] and I will take a look.
    Thanks,
    BIPuser

  • Report Writer Row and Column Format

    Hi
    Was wondering if there is a possible solution to this :-
    Understand that column format is controlled by format groups. This means that all figures in the same column will take the same format (such as scaling and decimal place).
    Scenario is ->
                        Colunn #1 -> column set as displaying no decimal point       
    Rev                  120
    OP                      5
    OP margin %     4.2 -> how to set this to 1 decimal point. Any formula syntax that I can use?
    Regards.

    Hi Vinay,
    Based on my research, freezing row and column headers are different in table and matrix.
    In a table, if we want to freeze column header, we should make the changes in the first Static row group in Row Groups pane with Advanced Mode as you said. If we want to freeze row header, the table should have a group ahead, then we can enable “Repeat header
    rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    In a matrix, if we want to freeze column header, we can enable “Repeat header columns on each page” and “Keep header visible while scrolling” options in Column Headers in Tablix Properties dialog box. If we want to freeze row header, we can enable “Repeat
    header rows on each page” and “Keep header visible while scrolling” options in Row Headers in Tablix Properties dialog box.
    Hope this helps.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for