Displaying multiple columns of a single column query

Would anyone happen to know how to display a result set in multiple horizontal columns as opposed to a single vertical column in ApEx?
Example:
select server_name from owner.servers;
A normal sql report would return:
server1
server2
server3
server4
server5
server6
What I'm looking for is a return that will display:
server1 server2 server3
server4 server5 server6

I'm sure there's a much better way, but one thing that popped into my head was to make your report be a Dynamic PL/SQL Region.
If you loop thru the records in a cursor, you can build a string and once you have "three" records, use the htp.p to print it out.
So something like this maybe:
v_count NUMBER(1);
v_data SERVERS.SERVER_NAME%TYPE;
v_string VARCHAR2(100);
CURSOR getdata IS
SELECT server_name
FROM servers
ORDER BY server_name;
BEGIN
v_count := 0;
OPEN getdata;
LOOP
FETCH getdata INTO v_data;
EXIT WHEN getdata%NOTFOUND;
v_count := v_count + 1;
IF v_count = 1 THEN
v_string := rpad(v_data,25,' ');
ELSIF v_count = 4 THEN
htp.p(v_string);
v_count := 1;
v_string := rpad(v_data,25,' ');
ELSE
v_string := v_string||rpad(v_data,25,' ');
END IF;
END LOOP;
CLOSE getdata;
END;
Variable lengths would need to be adjusted to fit your data, but you get the idea (hopefully).
Again, perhaps it's not the most efficient, but it would work.
Chad

Similar Messages

  • How To Concatenate Column Values from Multiple Rows into a Single Column?

    How do I create a SQL query that will concatenate column values from multiple rows into a single column?
    Last First Code
    Lesand Danny 1
    Lesand Danny 2
    Lesand Danny 3
    Benedi Eric 7
    Benedi Eric 14
    Result should look like:
    Last First Codes
    Lesand Danny 1,2,3
    Benedi Eric 7,14
    Thanks,
    David Johnson

    Starting with Oracle 9i
    select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
    from
    (select last, first, code, row_number() over(partition by last, first order by code) rn
    from a)
    connect by last = prior last and first = prior first and prior rn = rn -1
    start with rn = 1
    group by last, first
    LAST       FIRST      CODES                                                                                                                                                                                                  
    Lesand         Danny          1,2,3
    Benedi         Eric           7,14Regards
    Dmytro

  • Can I get multiple sums in a single column based on a "code" I place.

    After importing a file of check/debit card activity from my bank, can I 'code' the line items based on tax categories ie Utilities, Medical expenses, Auto expenses, etc. and then get sums for each based on that code I placed in a single column? That would mean multiple sums in a single column based on the code used for each tax related expense. For instance, I would put UT in the column for utilities expenses and MED in the same column if it were a medical expense. I would then want the sum for all items in that column for each item code. Is this possible or do I need to use a different approach to get this information.

    My guess is that the SUMIF function may be your friend.
    It's well described in the *iWork Formulas and Functions User Guid*e which every user may download from the Help menu.
    Yvan KOENIG (VALLAURIS, France) samedi 2 janvier 2010 21:56:39

  • Displaying 2 columns in a single column using HTML section of reports.

    Hi Team,
    I have a requirement in which we need to display 2 columns in the same column of OBIEE report. At present we have 2 columns as 2 different columns.
    For example if i have a column A which is used as @A in html section i need the new column to have @A + @B where B is another column in database.
    Can i concatenate 2 columns in a single column ?
    Thanks,
    Ritesh

    first select column 1 and column 2 in criteria.
    go to reaults are add narrater view.
    in narrater view type.
    @1@2[br/]
    set number of rows
    this should work in narrator.
    Edited by: user10615659 on May 20, 2013 4:30 PM

  • Combining two columns into a single column

    Hi,
    I have a VC Iview which displays the data of a query in a table .
    Output in a Table    
    ......................<<Quantity>>               <<Unit>>                     <<Amount>>               <<Currency>>
    &&Sales&&                                 
    Is it possible in VC to combine "Quantity" column and "unit" column to a single column say "Quantity"
    similarly "Amount" column and "currency" column to a single column"Amount"
    I.e i wanted to show the values in a single column some thing like this:
    &&Sales:&&                     <<120 Kg>>                                            <<500 Dollars>> ( 2 columns )
    Instead of( 4 columns) :
    &&Sales :&&           << 120>>              <<Kg>>                <<500>>                           <<Dollars>>
    Thanks
    P.Navakanth

    Hi,
    You could hide your actual columns for Quanity and unit and create one more column of type expression box in your table that will concatenate the value of quantity and unit.
    Regards,
    Murtuza Kharodawala

  • Query design question: multiple plan versions in single column

    I have a standard financial statement query with current month "Actual" restricted to Value Type 10 and current month "Plan" using Value Type 20.  This scenario is repeated for year-to-date Actual and Plan along with $ and % variance calculations.   Until recently we were only loading plan version so I had no reason to restrict the plan to version 0 Actual/Plan.
    We are now loading an alternate plan version, Version 1, and I would like to report both versions in the same query.  I though I could just bring in "Version" as a Free Characteristic to easily switch between version 0 and 1 but that didn't work as expected. 
    With "Version" as a filter item my Plan amount will report both plan versions combined which is fine and when "Version" is filtered to the alternate version 1 Plan correctly displays the alternate amount, in both cases Actual is unchanged and displays correctly.   The problem is when I change the filter to just show Version 0 which is defined as "Actual/Plan".  When version 0 is selected the Plan amount displays correctly but ALL Actual values disappear.
    No Version filter set = Actual/Plan and Plan Version 1 combined correctly.   Actual displays correctly.
    Filter set to 1 and 0  = Actual/Plan and Plan Version 1 combined correctly.   Actual displays correctly.
    Filter set to 1 = Plan Version 1 only.  Actual displays correctly.
    Filter set to 0 = Plan Version 0 only.  No actual data is displayed.
    Is there a better way of displaying multiple plan versions in a query or will I have to add additional columns for each plan version?
    Thanks for the ideas,
    Jeff

    Thanks Amit that was the help I needed.
    I added "Version" to every actual Key Figure and made each a Constant Selection.  I also added Version as a Free Characteristic of the query for a filter.
    By adding Version to each Key Figure no matter which plan version I select in the Version filter Actual data alway remains correct and just my Plan column changes to show the plan version I selected.
    Thanks for your help,
    Jeff
    Edited by: Jeff Mayfield on Nov 11, 2009 11:51 PM

  • Multiple conditin on a single column in a single query

    i want to select data from the table using diff conditions on a single column
    for eg:
    i need emp details like whose having empno as 5-15,19-45,50-89 ..etc this how can i give a condition in a single query
    we can use in or between for 2 or 3 conditions but i have plenty off like this

    Hi,
    848525 wrote:
    i want to select data from the table using diff conditions on a single column
    for eg:
    i need emp details like whose having empno as 5-15,19-45,50-89 ..etc this how can i give a condition in a single query
    we can use in or between for 2 or 3 conditions but i have plenty off like thisYou can use OR for any number of conditions; it works the same for 4 or more.
    You could also put the ranges into a table (or a sub-query, as shown below) and join:
    WITH     empno_ranges     AS
         SELECT     3000 AS low_val, 5000 AS high_val  FROM dual  UNION ALL
         SELECT     7000,           7499               FROM dual  UNION ALL
         SELECT     7500,           7599               FROM dual  UNION ALL
         SELECT     7800,           7899               FROM dual
    SELECT       r.*
    ,       COUNT (e.empno)     AS emp_cnt
    FROM            empno_ranges     r
    LEFT OUTER JOIN     scott.emp     e  ON  e.empno  BETWEEN r.low_val
                                                 AND     r.high_val
    GROUP BY  r.low_val, r.high_val
    ORDER BY  r.low_val
    ;Output:
    LOW_VAL   HIGH_VAL    EMP_CNT
       3000       5000          0
       7000       7499          2
       7500       7599          2
       7800       7899          3

  • Concatenate multiple row values into single column value

    Hello,
    Can anyone please refresh my memory on how to concatenate multiple row values into a single column value.
    In the following query, I will get multiple denial reasons per application and I would rather return all denial reasons on one line.
    SELECT a.application_id, a.membership_number,
    r.reason_text AS denial_reason,
    a.appl_receipt_date AS application_receipt_date,
    a.plan_request_1 AS application_plan_code,
    a.adjudication_date AS application_denial_date
    FROM application a, PLAN p, application_reason ar, reason r
    WHERE a.plan_request_1 = p.plan_cd
    AND a.application_id = ar.application_id
    AND ar.reason_id = r.reason_id
    AND a.adjudication_cd = 'D'
    AND a.appl_receipt_date BETWEEN '01-jan-2006' AND '31-dec-2006'
    AND p.plan_type_id = 12 and a.application_id = :appId
    ORDER BY application_id
    Any help is greatly appreciated.
    Thanks,
    -Christine

    found the following
    SELECT deptno,
           LTRIM(MAX(SYS_CONNECT_BY_PATH(ename,','))
           KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
    FROM   (SELECT deptno,
                   ename,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) AS curr,
                   ROW_NUMBER() OVER (PARTITION BY deptno ORDER BY ename) -1 AS prev
            FROM   emp)
    GROUP BY deptno
    CONNECT BY prev = PRIOR curr AND deptno = PRIOR deptno
    START WITH curr = 1;
        DEPTNO EMPLOYEES
            10 CLARK,KING,MILLER
            20 ADAMS,FORD,JONES,SCOTT,SMITH
            30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
    3 rows selected.at http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php

  • Library Filters: Filter for multiple values in a single column and Wildcards

    If you have a multi-value column in a library, can you filter to show only results where two (or more) specific values (terms) are applied? E.g. Year 2014 and Month January? Seems this would be particularly useful for Enterprise Keywords columns.
    Similarly, is there any way to filter on one value OR another value in a single column (e.g. Document Type Memo OR Fax)?
    Any way to use wildcards in searches (would be REALLY useful in the Title and Name columns when naming conventions have been followed).
    I'm guessing the answer is going to be 'move to SharePoint 2013' - if that is the case, please confirm whether all the scenarios mentioned above are catered for.

    Thanks for your replies !
    Is there any other way to achieve this ?
    There is 1 InfoObject which has 2 fields Employee and Department.
    Employee     Department
    001                A
    001                B
    001                C
    In the report there should be 1 row for Employee 001 with all the Departments displayed in the same cell separated by commas.
    Can this be done in the backend through a ABAP code?

  • Cannot add multiple filters on a single column on certain libraries

    On some of our lists/libraries, we can filter a single column to display a more than one selection. For example, column1 contains the following choices:
    Yes
    No
    Maybe
    I can add a filter to column1 and select Yes and Maybe. This works in some lists/libraries, but does not for others. When I try to select more than one value, the view resets and shows everything. The column we are trying to filter on is a choice column
    and is not calculated. Any help would be greatly appreciated.

    Hi,
    Where and how do you add your filter?
    If you add the filter in your view, you can add the filter as below:
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Multiple Selection Property in Single Column Listbox

    Hello All,
    I have taken a Single-column list box and have enable the multiple selection property of the listbox.
    In fact, i want to find out the values of the multiple rows selected in the listbox. But, i couldn't found any of the property of this listbox that can indicate the index or value of the multiple lines that are selected.
    Can anybody help me to resolve this issue? What is the approach i can take to find out the multiple rows selected in the listbox?
    Regards,
    Nishant

    Nishant wrote:
    Hello All,
    I have taken a Single-column list box and have enable the multiple selection property of the listbox.
    In fact, i want to find out the values of the multiple rows selected in the listbox. But, i couldn't found any of the property of this listbox that can indicate the index or value of the multiple lines that are selected.
    Can anybody help me to resolve this issue? What is the approach i can take to find out the multiple rows selected in the listbox?
    Regards,
    Nishant
    Here is an example where the value is read from a property node.
    the Value becomes an array when you elect a selection mode that allows multiple selections. (and thats the reason you can't write Selection mode while the VI is running
    Jeff
    Attachments:
    Listbox.vi ‏7 KB

  • Display Multiple reports in a single query view

    Hi Team,
    I have 3 similar reports for MTD, QTD & YTD.
    While displaying the report in the portal..  I want to display the reports in a single view wherein the MTD report will be a default report for the input selections. whereas the QTD & YTD will be available as dropdown options in the same query view and the wll be executed for the same input selections.
    Please advice how to design the view.
    Regards
    Sneha

    Hi All,
    I have created a Web Template for my requirement.
    Now while adding the template to my Transport request, I am getting the following error message:
    Object 'BTMP::0ANALYSIS_PATTERN_EXPORT' refers to the invalid object 'QU::'
    Object 'BTMP::0ANALYSIS_PATTERN_INFO' refers to the invalid object 'QU::'
    PLEASE ADVICE...
    Regards
    Sneha
    Edited by: Sneha Santhanakrishnan on Aug 8, 2011 12:18 PM

  • Merge two column value in single column

    Team,
    I have a requirement where in I need to merge 2 column values in a single column.
    ex. I have Percent_complete column in my table. and my table has only one record.
    I need to query such that I need to store the values of percent_complete and (100- percent_complete) values in a single column.
    ex
    Percent complete has 30 value.
    I need to select 30 and 70(100-30) both in a single column.
    Thanks,

    SQL> select  *
      2    from  tbl
      3  /
    PERCENT_COMPLETE
                  30
    SQL> select  abs(grouping(1) * 100 - max(percent_complete)) percent_complete
      2    from  tbl
      3    group by rollup(1)
      4  /
    PERCENT_COMPLETE
                  30
                  70
    SQL> select  nvl(percent_complete,100 - max(percent_complete)) percent_complete
      2    from  tbl
      3    group by rollup(percent_complete)
      4  /
    PERCENT_COMPLETE
                  30
                  70
    SQL>
    SY.

  • Merge Two Columns in a Single Column

    Dear,
    Inputs
    Table1 |
    Col1 (Number) |
    1 |
    2 |
    3 |
    4 |
    5 |
    6 |
    and table 2
    Table2 |
    Col1 (Number) |
    7 |
    8 |
    9 |
    10 |
    11 |
    12 |
    No relation between the two tables
    I want to write a select statement that will result
    Column
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    No sorting is required, I just need to have all the values listed in a single column... How can I do?
    Thanks in Advance.

    If there is dup values between the two tables and you want get only unique, use UNION. If not UNION ALL as already stated.
    Nicolas.

  • How to disable JTable Column Dragging (only single column)

    How could i disable a single column from being dragged in JTable?
    I need to fix the first column from being dragged in JTable and all other columns except the first can be dragged. how would i accomplish this task ?
    well, i know how to fix all column in jtable from being dragged using
    table.getTableHeader().setReorderingAllowed(false);But dont know how to fix only a single column. is there any method for doing this. or i have to implement any other logic?
    Please help me !
    Thanks

    The question is why do you have this requirement. I figure if the user wants to reorder the colum, let them, the table won't break.
    Maybe something like this would be acceptable:
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class FixedColumnScrollPane extends JScrollPane
        public FixedColumnScrollPane(JTable main, int fixedColumns)
            super( main );
            //  Use the table to create a new table sharing
            //  the DataModel and ListSelectionModel
            JTable fixed = new JTable( main.getModel() );
            fixed.setFocusable( false );
            fixed.setSelectionModel( main.getSelectionModel() );
            fixed.getTableHeader().setReorderingAllowed( false );
    //        fixed.getTableHeader().setResizingAllowed( false );
            fixed.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            main.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
            //  Remove the fixed columns from the main table
            for (int i = 0; i < fixedColumns; i++)
                TableColumnModel columnModel = main.getColumnModel();
                columnModel.removeColumn( columnModel.getColumn( 0 ) );
            //  Remove the non-fixed columns from the fixed table
            while (fixed.getColumnCount() > fixedColumns)
                TableColumnModel columnModel = fixed.getColumnModel();
                columnModel.removeColumn( columnModel.getColumn( fixedColumns ) );
            //  Add the fixed table to the scroll pane
            fixed.setPreferredScrollableViewportSize(fixed.getPreferredSize());
            setRowHeaderView( fixed );
            setCorner(JScrollPane.UPPER_LEFT_CORNER, fixed.getTableHeader());
        public static void main(String[] args)
            //  Build your table normally
            JTable table = new JTable(10, 8);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            JScrollPane scrollPane= new FixedColumnScrollPane(table, 1 );
            JFrame frame = new JFrame("Table Fixed Column Demo");
            frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
            frame.getContentPane().add( scrollPane );
            frame.setSize(400, 300);
            frame.setVisible(true);
    }Or maybe you should be using a Row Header. A row header is like the column header of JTable. It remains fixed on the left side of the scroll pane. Search the forum for examples using "setrowheaderview".

Maybe you are looking for

  • Reporting Tab is not showing in SCSM 2012 SP1 Console

    I'm working with SCSM 2012 SP1. But after installing data ware house only "DataWareHouse" tab appares no "Reporting" tab. And it shows below MSG: And only the below reporting management pack are available in the Data Ware House >> Management pack are

  • Problem to install SAP R/3 4.6 on Windows server entreprise 2003

    Hello all, I've a problem to install SAP R/3 on a windows enterprise server 2003. This is the step I made : 1) Install Windows enterprise server 2003 2) Add IPX and Netbios to the network (adress ip 192.168.10.2) 3) Add 192.168.10.2 srv1 SAPTRANHOST

  • Multiple templates one data definition--

    Hi I have created two templates for the same data definition. Now while running the concurrent request i can select the template from the 'Options' button. Say the two templates are 1)template1 2)template2 Now template1 is the default template when i

  • Downloading purchased app more then 3 year later

    I'm trying to download an app I had deleted but decided to re-download.  It's a Mahjong game & back in 2010 I bought a layout addition to the game & later deleted it.  I downloaded the app again just recently but the game will not allow the layout pa

  • My parts are done, But now how do I Make the actual movie!

    I edited my individual parts of the movie I am making and now i want to put them all on DVD so i can watch the movie fully through. Whats the next step? Do i need to somehow export each part of the video then load and burn them onto the DVD? I want t