3 Replies Latest reply: Jan 8, 2013 9:41 AM by 903224 RSS

    Horizontal

    903224
      i need to increase the number in the below output horizontally, any idea how to do that ?

      Table(3 Rows) Data
      COLUMN
      COLUMN
      COLUMN
      if the input is 3(number of rows) then output should be

      a.COLUMN1,a.COLUMN2,a.COLUMN3

      Edited by: 900221 on Jan 8, 2013 7:40 AM
        • 1. Re: Horizontal
          sb92075
          900221 wrote:
          i need to increase the number in the below output horizontally, any idea how to do that ?
          select 'a.'||LISTAGG('COLUMN', ',a.') WITHIN GROUP (ORDER BY null) column_name 
          from all_cons_columns 
          where upper(Table_name) ='Table_name' 
          and upper(owner)='Owner'
          and upper(constraint_name) like 'PK%'
          if the input is 3 then output should be

          a.COLUMN1,a.COLUMN2,a.COLUMN3
          input?
          input from where?
          input to what?

          Handle:     900221
          Status Level:     Newbie
          Registered:     Dec 1, 2011
          Total Posts:     71
          Total Questions:     26 (20 unresolved)


          why so MANY unanswered questions?
          • 2. Re: Horizontal
            Peter vd Zwan
            Hi did you want this?
            select LISTAGG('a.' || COLUMN_name, ',') WITHIN GROUP (ORDER BY null) column_name 
            from all_cons_columns 
            where upper(Table_name) ='Table_name' 
            and upper(owner)='Owner'
            and upper(constraint_name) like 'PK%'
            Regads,

            Peter

            Edited 'column' -> column_name

            Edited by: Peter vd Zwan on Jan 8, 2013 8:09 AM
            • 3. Re: Horizontal
              903224
              Hi- Updated my question.