How can I display the rows into columns.

How can I display the rows into columns. I mean
Create table STYLE_M
(Master varchar2(10), child varchar2(10));
Insert itno style_m
('MASTER1','CHILD1');
Insert itno style_m
('MASTER2','CHILD1');
Insert itno style_m
('MASTER2','CHILD2');
Insert itno style_m
('MASTER3','CHILD1');
Insert itno style_m
('MASTER3','CHILD2');
Insert itno style_m
('MASTER3','CHILD3');
Note : The Master may have any number of childs.
I want to display like this..
Master child1, child2, child3, .......(dynamic)
MASTER1 CHILD1
MASTER2 CHILD1 CHILD2
MASTER3 CHILD1 CHILD2 CHILD3
Sorry for disturbing you. Please hlp me out if you have any slution.
Thanks alot.
Ram Dontineni

Here's a straight SQL "non-dynamic" approach.
This would be used if you knew the amount of children.
SELECT
     master,
     MAX(DECODE(r, 1, child, NULL)) || ' ' || MAX(DECODE(r, 2, child, NULL)) || ' ' || MAX(DECODE(r, 3, child, NULL)) children
FROM
     SELECT
          master,
          child,
          ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r
     FROM
          style_m
GROUP BY
     master
MASTER     CHILDREN                        
MASTER1    CHILD1                          
MASTER2    CHILD1 CHILD2                   
MASTER3    CHILD1 CHILD2 CHILD3             Since you said that the number of children can vary, I incorporated the same logic into a dynamic query.
SET AUTOPRINT ON
VAR x REFCURSOR
DECLARE
        v_sql           VARCHAR2(1000) := 'SELECT master, ';
        v_group_by      VARCHAR2(200)  := 'FROM (SELECT master, child,  ROW_NUMBER() OVER(PARTITION BY master ORDER BY child) r FROM style_m) GROUP BY master';
        v_count         PLS_INTEGER;
BEGIN
        SELECT
                MAX(COUNT(*))
        INTO    v_count
        FROM
                style_m
        GROUP BY
                master;
        FOR i IN 1..v_count
        LOOP
                v_sql := v_sql || 'MAX(DECODE(r, ' || i || ', child, NULL))' || ' || '' '' || ';
        END LOOP;
                v_sql := RTRIM(v_sql, ' || '' '' ||') ||' children ' || v_group_by;
                OPEN :x FOR v_sql;
END;
PL/SQL procedure successfully completed.
MASTER     CHILDREN
MASTER1    CHILD1
MASTER2    CHILD1 CHILD2
MASTER3    CHILD1 CHILD2 CHILD3I'll point your other thread to this one.

Similar Messages

  • How can I display the data in table in separate column?

    I have a vi reading data one by one in the same column.
    How can I display the data with separate column?
    like this:
    data 1 | read | read
    data 2 | read | read
    data 3 | read | read
    (would you mind if I will ask for an example
    because it is much easier for me to work
    with an example)
    THANK YOU.

    If you're reading your data in as a 1D array, this is as simple as using the Reshape Array to make a 2D array. I've attached an example in LabVIEW 6.1 format. The example rearranges a single column of data fill several columns horizontally, but you can easily modify this code to fill the columns downward instead.
    Attachments:
    Data_Column_Example.vi ‏18 KB

  • How can  i  display the Number  instead of  E

    Hello Everyone ;
    I am getting confused. How can i display the Number but the Exponential value is coming as E.
    SQL> select sum(amount_sold) from sales;
    SUM(AMOUNT_SOLD)
    1.1287E+11
    Table details ..
    SQL> desc sales
    Name                                          Null?        Type
    AMOUNT_SOLD NUMBER
    i want to change 1.1287E+11 to "numeric"
    DB : 10.2.0.4
    os : rhel 5.1

    Just a minor correction on an obvious math/responding too fast error: 1.1287E+11 is a 12 digit number. You move the decimal 11 positions to the right which would add 7 zeroes to the value.
    MPOWEL01> l
      1  select length(to_char(1.1287E+11)), to_char(1.1287E+11,'999,999,999,999'), 1.1287E+11 "TEST"
      2* from sys.dual
    MPOWEL01> col TEST format 999999999999
    MPOWEL01> /
    LENGTH(TO_CHAR(1.1287E+11)) TO_CHAR(1.1287E+          TEST
                             12  112,870,000,000  112870000000the problem was that the OP failed to alias the sum result to the formatted column rather than the lenght of the data.
    HTH -- Mark D Powell --

  • How can i display the days of the month in my report, please help

    dear all
    my table name is day_close_table
    it contains these columns:
    product_code number,
    the_date date,
    sale_qty number,
    buy_qty number
    price number
    i need to make report like the fiollowing
    product : 10144 from: 1-jan-2006 to :10-jan-2006
    days | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    Sale | 50| 10| 20| 15|10|5 | 6 | 11|12|6 |
    buy |10 | 20 | 10| 0 | 0 | 0 | 10| 1 | 1| 1|
    i created two query and i decieded to join them
    the first one is to display days in horizon direction
    my query is:
    SELECT TO_CHAR(THE_DATE,'DD-MONTH')D,
    FROM HS_DAY_CLOSE;
    my question is how can i display the records in horizone direction
    please help

    i solved this problem using this query
    SELECT STOCK_CODE, COUNTRY_ID,
    SUM(DECODE(to_char(the_date,'dd') ,'01', buy_qty)) "1",
    SUM(DECODE(to_char(the_date,'dd') , '02', buy_qty)) "2",
    SUM(DECODE(to_char(the_date,'dd') , '03', buy_qty)) "3",
    SUM(DECODE(to_char(the_date,'dd') , '04', buy_qty)) "4",
    SUM(DECODE(to_char(the_date,'dd') , '05', buy_qty)) "5",
    SUM(DECODE(to_char(the_date,'dd') , '06', buy_qty)) "6",
    SUM(DECODE(to_char(the_date,'dd') , '07', buy_qty)) "7",
    SUM(DECODE(to_char(the_date,'dd') , '08', buy_qty)) "8",
    SUM(DECODE(to_char(the_date,'dd') , '09', buy_qty)) "9",
    SUM(DECODE(to_char(the_date,'dd') , '10', buy_qty)) "10",
    SUM(DECODE(to_char(the_date,'dd') , '11', buy_qty)) "11",
    SUM(DECODE(to_char(the_date,'dd') , '12', buy_qty)) "12",
    SUM(DECODE(to_char(the_date,'dd') , '13', buy_qty)) "13",
    SUM(DECODE(to_char(the_date,'dd') , '14', buy_qty)) "14",
    SUM(DECODE(to_char(the_date,'dd') , '15', buy_qty)) "15",
    SUM(DECODE(to_char(the_date,'dd') , '16', buy_qty)) "16",
    SUM(DECODE(to_char(the_date,'dd') , '17', buy_qty)) "17",
    SUM(DECODE(to_char(the_date,'dd') , '18', buy_qty)) "18",
    SUM(DECODE(to_char(the_date,'dd') , '19', buy_qty)) "19",
    SUM(DECODE(to_char(the_date,'dd') , '20', buy_qty)) "20",
    SUM(DECODE(to_char(the_date,'dd') , '21', buy_qty)) "21",
    SUM(DECODE(to_char(the_date,'dd') , '22', buy_qty)) "22",
    SUM(DECODE(to_char(the_date,'dd') , '23', buy_qty)) "23",
    SUM(DECODE(to_char(the_date,'dd') , '24', buy_qty)) "24",
    SUM(DECODE(to_char(the_date,'dd') , '25', buy_qty)) "25",
    SUM(DECODE(to_char(the_date,'dd') , '26', buy_qty)) "26",
    SUM(DECODE(to_char(the_date,'dd') , '27', buy_qty)) "27",
    SUM(DECODE(to_char(the_date,'dd') , '28', buy_qty)) "28",
    SUM(DECODE(to_char(the_date,'dd') , '29', buy_qty)) "29",
    SUM(DECODE(to_char(the_date,'dd') , '30', buy_qty)) "30",
    SUM(DECODE(to_char(the_date,'dd') , '31', buy_qty)) "31"
    FROM HS_DAY_CLOSE
    GROUP BY STOCK_CODE,COUNTRY_ID

  • How can i display the login details in the Web Ui

    Hi All,
              How can i display the information regarding the person who logged into the Web Ui and where can i find the seetings regardin this.Please provide your valuable suggestions
    Regrads,
    Lakshman.P

    look at this link https://wiki.sdn.sap.com/wiki/display/CRM/WelcomeUserMessageinWeb+UI and you will solve your problem.
    have a nice day.

  • How can I display the front panel of the dinamically loaded VI on the cliente computer, the VI dinamically loaded contains files, I want to see the files that the server machine has, in the client machine

    I can successfully view and control a VI remotly. However, the remote VI dinamically loads another VI, this VI loaded dinamically is a VI that allows open others VIs, I want to see the files that contains the server machine, in the client machine, but the front panel of the dinamic VI appears only on the server and not on the client, How can I display the fron panel with the files of the server machine of the dinamically loaded VI on the client computer?
    Attachments:
    micliente.llb ‏183 KB
    miservidor.llb ‏186 KB
    rdsubvis.llb ‏214 KB

    I down loaded your files but could use some instructions on what needs run.
    It seems that you are so close yet so far. You need to get the data on the server machine over to the client. I generally do this by doing a call by reference (on the client machine) of a VI that is served by the server. THe VI that executes on the server should pass the data you want to diplay via one of its output terminals. You can simply wire from this terminal (back on the client again) to an indicator of your choosing.
    Now theorectically, I do not think that there is anything that prevents use from getting the control refnum of the actual indicator (on the server) of the indicator that has the data, and read its "Value" using a property node. I have never tried this idea but it seems t
    hat all of the parts are there. You will need to know the name of the VI that holds the data as well as the indicator's name. You will also have to serve all VI's. This is not a good idea.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How can I display the range for LastFullMonth in the header of a report

    How can I display the month for LastFullMonth in the header of a report run in the past so that a report that ran sept 1 2009 selecting data for LastFullMonth (august 2009)  displays sept 2009 in the header even if there is no data selected by the report?

    Good,
    Sometimes I answer these questions and completly miss it....
    ( lack of understanding on my part )   

  • How can I display the HTML page from servlet which is called by an applet

    How can I display the HTML page from servlet which is called by an
    applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
    I am calling my struts action class from the applet. I want to show the response in the same browser.
    Code samples will be appreciated.

    hi
    I got one way for this .
    call a javascript in showDocument() to submit the form

  • How can i display the message

    public class Userdefined extends Exception {
              Userdefined(String sparam){
              System.out.println(sparam);
              Userdefined(){
         private static int acno[]={100,105};
         private static double bal[]={100.00,200.00};
         public static void main(String args[]) {
              try{
              for(int i=0;i<2;i++)
                   System.out.println("ACCCCNO------>"+acno[i]+"BAl------>"+bal);
                   if(bal[i]<150.00)
              Userdefined udexp=new Userdefined("bal less");
              throw udexp;
              catch(Userdefined e){
                   System.out.println("--->"+e);
    How can i display the message "less amt" using my parmeterized constructor.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    VinayTK wrote:
    How can i display the message "less amt" using my parmeterized constructor.Erm ... what? You can't --- at least not with the stuff you've got there.
    A properly formed question, with some idea of what you're trying to accomplish would be a huuuuge help.
    Winston
    BTW: Congratulations. At my age, 'first's in computing are rare; but it's definitely the first time I've seen an Exception class with a main() method.
    Edited by: YoungWinston on Sep 1, 2009 9:46 AM

  • How can i display the error count

    Hi I'm using jdev11g
    How can i display the count of errors in validation error message pop up instead of displaying the entire list.

    Searching the forum would help
    Re: How to customize Error?

  • How can I display the vendor associated with result of my running total sum

    I have a report that lists vendors with their most vecent order dates.  I need to set up a rotation so that the vendor with the latest order date is next to be selected.  I used the running total summary to pick the latest date.  How can I display the vendor associated with result of my running total summary?

    If your "latest" order date means the "oldest" order date, why don't you try this:
    Go to Report tab -> Record Sort Expert -> Choose your order date in ascending order
    This will make your oldest order your first record shown. 
    You can then create a running total count for each record.
    Lastly, in your section expert under conditional suppress X+2 formula, write this:
    {#CountRecords}>1
    The result will only show the oldest record in your report.
    I hope that helps,
    Zack H.

  • How can we display the list of Report Names in Dashboard Prompt?

    How can we display the list of Report Names in Dashboard Prompt?

    Hi,
    No its not possible to display list of reports in dashboard prompts.
    Can do this using SQl results in prompt(we write query checking out report names manualy),but its not easy thing if you are having many report names to be displayed.
    Assign points and close your threads if answered.
    Refer : http://forums.oracle.com/forums/ann.jspa?annID=939
    Regards,
    Srikanth

  • How can i display the latest " 4 Posts" in Facebook WebPart in SharePoint?

    Hi All,
    I have created Facebook WebPart in SharePoint, using below code
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=807273262643415&version=v2.0";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <div class="fb-like-box" data-href="https://www.facebook.com/FacebookDevelopers" data-width="300" data-height="200" data-colorscheme="light" data-show-faces="true" data-header="true" data-stream="true"
    data-show-border="true"></div>
    Now all Likes and Posts are displayed, here i want to display the latest " 4 Posts " only.
    how can i display the latest " 4 Posts".

    Hi,
    As a workaround, we can use jQuery to hide or remove other posts.
    http://www.w3schools.com/jquery/jquery_dom_remove.asp
    You can also connect the Facebook to find whether it provide a api to achieve your requirement or not.
    Or you can try to modify the js file. Facebook provide a debug version of the JavaScript SDK.
    https://developers.facebook.com/docs/javascript/quickstart/v2.2
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How can I display the holiday list in the portal

    System
    ECC 6.0
    EP 7.0
    ESS/MSS 1.0
    how can I display the holiday list in the portal.
    There will be a holiday list created by the ABAP-er in ECC, how can I include it in the portal?

    Hi,
    Create a WebDynpro Iview to create a simple application that pulls information from the RFM(that you has ABAPer created).
    Start from <a href="https://www.sdn.sap.com/irj/sdn/developerareas/webdynpro?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#backend">Here</a>
    (Or)
    To get an idea, download the world time BP from below link. It has calender with holidays displayed.
    http://www.sweetlets.com/world_times_preview.html
    Regards,
    N.

  • I have written an ebook that has been created for kindle. How can I export the book into iBooks author?

    I have written an ebook that has been created for kindle. How can I export the book into iBooks Author?
    I have tried converting the book to different files like, mobi, epub, pdf. By using an app on my iphone.
    I still cannot add it to iBooks Author.
    I'm stuck, Please help me!

    Either use copy/paste and then format/style as desired, or take it to Pages or WORD and insert chapters - which may still require resettling.
    If you're looking for a 1:1 port, with all styles and layout intact, you may be dissapointed, tho.

Maybe you are looking for

  • How do I see my two Macs on the same screen?

    This may sound like an extremely stupid question but if I want to use Migration Assistant, how can I see what's going on on both computers when I have only one screen?  I have an old Mac Mini and a new Mac Mini.  I've hooked them up using an ethernet

  • Adobe CC 2015 issues

    Anyone else facing issues with Adobe?We have about 25 users that work on graphics in our company, they use: - Illustrator - Photoshop - InDesign, etc...Since Adobe (auto)-updated their software from 2014 to 2015 edition, all of our users are complain

  • Nasty HTML / Outlook 2007 Bug in iPhone 2.0?

    Anyone else notice a nasty HTML / Outlook 2007 bug with iPhone 2.0? I've pasted the bug that I submitted to Apple below. So far I've gotten no response. =( Summary: I have found a major bug with sending and receiving HTML emails between iPhone 2.0 an

  • Can we define a parameter within a subroutine?

    Can we define a parameter within a subroutine?

  • What is the error code 2147220969 mean? how to rectify it?

    I'm using NI labview 2011 after connecting IEEE 1394 camera with image grabber h/w and clicling acquire image in NI Vision window the camera is detected on moving to further steps a dalog appears showing error code 2147220969.