How to Get the Column Value in Newline in Oracle 10g

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gurujothi D
    New Member
    • Feb 2012
    • 23

    How to Get the Column Value in Newline in Oracle 10g

    Hi Everyone,
    Here my requirement is,
    My Emp table have the following 3 columns,

    Id , Name and programming

    it has the following values,

    Id Name Programming
    -- ---- -----------
    1 Raju Java,Plsql,sql
    2 Kamal C,C++,Java


    now I need the output in the following format,
    Id Name Programming
    -- ---- -----------
    1 Raju Java
    plsql
    sql
    2 kamal c
    c++
    Java.

    Can anyone suggest me the code to get the above format?
    Thank you in advance.


    With regards,
    gurujothi.D
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    Actually from what you paste here it is hard to find out what output format do you want.

    Comment

    • Gurujothi D
      New Member
      • Feb 2012
      • 23

      #3
      Dear rski,
      Directly I edited but it is not a right format,eventhou gh i edited the format which i need it became like above, from where i have to edit and paste it here? please let me know?

      Comment

      • rski
        Recognized Expert Contributor
        • Dec 2006
        • 700

        #4
        Use [code] tags.
        Do you want something like that?
        Code:
        Id Name Programming 
        -- ---- -----------
        1  Raju  Java 
                 plsql 
                 sql 
        2  kamal c 
                 c++ 
                 Java.
        I mean two displayed rows but programming splitted into multiple lines?

        Comment

        • Gurujothi D
          New Member
          • Feb 2012
          • 23

          #5
          Dear RSKI,
          I need the exact same above output.How can I get that?

          Comment

          • rski
            Recognized Expert Contributor
            • Dec 2006
            • 700

            #6
            Try this
            Code:
            select id, name, translate(wm_concat(programming),',',chr(13)) as programming from test group by id, name;

            Comment

            • Gurujothi D
              New Member
              • Feb 2012
              • 23

              #7
              Dear RSKI,
              Am getting the following error in toad,
              ORA-00904: "WM_CONCAT" : invalid identifier

              Comment

              • rski
                Recognized Expert Contributor
                • Dec 2006
                • 700

                #8
                This function is owned by WMSYS user. Maybe you have no provilege to use it.
                Does this query return something
                Code:
                select * from all_objects where object_name ='WM_CONCAT'

                Comment

                • Gurujothi D
                  New Member
                  • Feb 2012
                  • 23

                  #9
                  Hi RSKI,
                  No rows returned.

                  Comment

                  • rski
                    Recognized Expert Contributor
                    • Dec 2006
                    • 700

                    #10
                    Looks like you have no privilege to use this function.
                    After googling I foun this forum

                    Several methods of combining multiple rows of data into a single row using aggregate functions.


                    you should find solution here.

                    Comment

                    • Gurujothi D
                      New Member
                      • Feb 2012
                      • 23

                      #11
                      Hi RSKI,
                      Thank you so much for your passion.

                      Comment

                      Working...