Retrieve multiple row single column output as single string

hii
I have query like "select country_name from country_master where <condition>".
This query results in multiple rows. I want those multiple rows as a string like "country1, country2, contry3".
I know i can write a function/cursor to achieve that but want to know if we have a way to get that within the query itself.
Thanks

In 10g...
SQL> select dname from dept;
DNAME
ACCOUNTING
RESEARCH
SALES
OPERATIONS
IT SUPPORT
SQL> ed
Wrote file afiedt.buf
  1  select ltrim(sys_connect_by_path(dname,','),',') as depts
  2  from (select dname, row_number() over (order by deptno) rn from dept)
  3  where connect_by_isleaf = 1
  4  connect by rn = prior rn + 1
  5* start with rn = 1
SQL> /
DEPTS
ACCOUNTING,RESEARCH,SALES,OPERATIONS,IT SUPPORTIn 11g, you can use the LISTAGG analytical function.

Similar Messages

  • Populate multiple rows and columns based off of a single cell

    Does anyone know a way to populate multiple rows and columns based off of the input of a single cell. I'm trying to create a workout tracker that auto populates from a master list of workouts. Example, in A2 the user selects the workout from a drop down menu (St1, St2, St3, etc) and the workout is pulled from the master list and is populated into B2:C5.
    I'm using =LOOKUP(A2,Master :: A2:A32,Master :: C2:C32) right now, but it's only drawing the top column. I'm looking for an edit for the formula (or completely new formula) that will place the info from the 1st column of the Master table into the 1st column of the Auto Tracker 1 table and then on down until the 4th column.
    Here is a screen shot of what I have now:
    And an example of what I'd like to accomplish:
    Any and all help is appreciated, and please let me know if there is any more info that I can give that'd help out.

    Hi Mike,
    Your screenshots show that you have merged some cells in Column A of both tables. That may be the reason why the LOOKUP function is having trouble working out which range of cells to examine.
    Hope this helps.
    Regards,
    Ian.

  • Merge multiple rows of same ID into Single row

    Hi All,
    I need the requirements of merging multiple rows of same ID as single row.
    My Table Data:
    ID     Language1 Language2 Language3 Language4
    1001 NULL         JAPANESE  NULL          NULL
    1001 SPANISH   NULL          NULL          NULL
    1001 NULL        NULL           NULL         ENGLISH
    1001 NULL        NULL           RUSSIAN    NULL
    Required Output Should be,
    ID     Language1 Language2 Language3 Language4
    1001 SPANISH    JAPANESE  RUSSIAN   ENGLISH
    Please help me to achieve this output.
    Tried grouping but its not working also producing the same result.
    Thanks.
    Live freee....Joy forever................ :)

    Try the below:
    create Table Test_Sample(ID int,Language1 varchar(50), Language2 varchar(50), Language3 varchar(50), Language4 varchar(50))
    Insert into Test_SAmple Values(1001,NULL,'JAPANESE', NULL, NULL),
    (1001,'SPANISH', NULL, NULL, NULL),
    (1001,NULL, NULL, NULL, 'ENGLISH'),
    (1001,NULL, NULL, 'RUSSIAN', NULL)
    Select ID,MAX(Language1),MAX(Language2),MAX(Language3),MAX(Language4)
    From Test_Sample
    Group by ID
    Drop table Test_Sample

  • Want to be able to open tabs in multiple rows, rather than in a single row. I used tab mix plus before, but it says it is not compatible with New tab Homepage. The older version of Firefox allowed this very easily.

    Want to be able to open tabs in multiple rows, rather than in a single row. I used tab mix plus before, but it says it is not compatible with New tab Homepage. The older version of Firefox allowed this very easily.

    Your plugins list shows outdated plugin(s) with known security and stability risks.
    *Java Plug-in 1.5.0_06 for Netscape Navigator (DLL Helper)
    Update the [[Java]] plugin to the latest version.
    *http://java.sun.com/javase/downloads/index.jsp (Java Platform: Download JRE)

  • FWD: Re: Retrieving multiple rows from a database into morethan

    There are two ways to do this that I cn think of right off the bat.
    One is to create a class of objects that can receive the entire row, and
    give it methods that will return each of the individual objects that you are
    looking for when called. If you use INTO :ARRAY, you get the advantage of
    being able to pass the array anywhere in your system for the 'split up'
    processing.
    Two is to do basically the same thing, but instead doing the 'split up'
    during a for loop. This will appear to slow down your query, however, as
    extra processing will be occuring in terms of memory allocation and copying.
    I'm sure there other approaches. This was simply what came to mind at
    midnight, after a long day :-).
    At 01:33 AM 6/4/96 +0000, you wrote:
    Does anyone know of a way to retrieve multiple rows from a single table in an
    RDB database into more than 1 object, using a single SQL call?
    I have a single table that I wish to use some fields to populate one object
    and some others to populate another.
    The FOR clause only allows one object to be specified.
    The INTO :ARRAY clause also seems to only allow one object to be specified.
    I would appreciate any help.
    Regads,
    Steve Isaac
    Hydro Electric Commission
    Hobart TAS 7001
    Australia
    [email protected]
    James Urquhart Voice: (510)869-3400
    [email protected] Fax: (612)921-8243
    Forte Consulting

    wow, that was pleasant, the usual format goes:
    Newb: I have a problem, fix it for me
    Forum: Here's a link explaning the concept you obviously don't grasp
    Newb: No, fix it FOR me
    Forum: I'll fix you!
    Newb: WAAAAH!
    Forum: BAN!

  • Web dynpro screen with multiple rows with columns that can be edited

    Web dynpro screen with multiple rows with columns that can be edited individually:
    Hi
    I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7).
    I need to add 'n type of table (or almost something like Excel) or something in which someone can type a few paycode numbers (there should be lets say 10 blank rows in which info can be typed in and if I click on a button or so, more rows must be added if necessary.  Then in the other colums stuff like amounts must be entered which one should also be able to edit then and there.
    Can anyone assist in what I can use for this?  There does not seem to be some existing element that I can use.
    Help will be appreciated.
    Regards
    Debbie

    Hi Debbie,
    Whiel Creating table you need to be care full that use chose INPUT FIELD as the CELL EDITOR. Just guessing that if ur table is not editable u might have choosen TextView as default cell editor type.
    check link for details on TABLE UI
    [http://help.sap.com/saphelp_erp2005/helpdata/EN/b5/ac884118aa1709e10000000a155106/frameset.htm]
    easy way is to first add UI ELEMENT TABLE to your VIEW, then right click over it & select create binding from context. After you have a pop up where you can select what columns you want what should be its cell editor etc.
    Greetings
    Prashant

  • Adding and Deleting Multiple Rows or Columns

    How do you add or delete more than one row or column at a time.

    Robby! wrote:
    That's a great finding!
    I just wrote a feedback requesting a shortcut like this.
    It is a pity though that they desing it to work only if you select the header of the row/column. It should be enabled to work from within any cell in the table.
    Who wrote such an error ?
    These interesting shortcuts behave flawlessly even if the cursor was in D18 for instance.
    (a) I never saw them in the delivered resources.
    (b) they aren't responding to the OP's question which was about "Adding and Deleting Multiple Rows and Columns"
    Yvan KOENIG (from FRANCE vendredi 3 octobre 2008 18:39:01)

  • Reading each value from spreadshee​t file with delay (multiple rows and columns)

    Hi,
    a) I want to read EACH VALUE from a spreadsheet file having multiple rows and columns WITH DELAY. I am attaching my VI and sample datalog file for reference (tempsensor.txt).I need to do so because as soon as I read put ON the Sensor button on front panel, LV reads all the values at one go. I need the values for each temperature to be displayed after a delay.
    b) Secondly, I would like to read another file containing the state of four antennas (deployed:1; undeployed:0). I am logging state of each antenna in each column of the file(magnet.txt) I need to have four LEDS on front panel to display state of the antennas. I dont know what I have done for antennas in my VI is right or wrong. I guess thats rhe wrong way to approach the problem. Please help!!!(column1: Antenna1 state ; Column2:Antenna2 state.. and so..on..)
    Any help would be greatly appreciated!!
    Thanks in advance,
    Ratnesh
    FYI: The first column in my datalog file represents timestamp(number of seconds elapsed), second column: reading for temperature sensor 1, third column: reading for temperature senosr 2, and so on. I am using approx. 11 temperature sensors.
    Also, I have generated the log files for the reference purpose only. They do not represent the actual values. They are far away from actual values.
    Attachments:
    01032005.zip ‏30 KB

    Look at this modified version of your VI. After looking at it, I determined that a shift reggister was not required in this case.
    Lynn
    Attachments:
    MultiSensors.2.vi ‏85 KB

  • How to save data from JTable multiple rows and columns

    Hi Y_Not thanks for your help before...
    But what should I do if I want to get/save many data from many column and rows??

    i don't quite understand your (repeated) question. what is the problem with "multiple rows and columns". Y_NOT and i have shown you ways to access them.
    all you need are 2 loops: one around your number of rows and one around the number of columns or vice versa depending in which order you want to save things:
    for (int col = 0; col < data.size(); col++) {
        for (int row = 0 ; row < data[col].size(); row++) {
            // save your data
            saveData(data[col].getElementAt(row));
            // or use yourtable.getValueAt(row, col);
    }this is not a problem of Swing/Java but of simple algorithm...
    thomas

  • Adding multiple rows or columns to a sheet

    Hi There,
    I'm new to this so pardon me please.......I've tried everything, I've looked everywhere..........does anyone know how to add in multiple rows or columns into the middle of a worksheet? There has to be a quicker way to throw in a quick 20 rows rather than just doing it one by one?????
    Frustratingly yours
    Morris

    Hello
    It seems that you missed a detail:
    +1. Highlight the number of columns you want to add before or after your insertion point.+
    +_2. Control click to get menu._+
    +3. Select "Add Columns Before" or "Add columns After" - whichever is appropriate.+
    without Control
    with Control depressed
    Yvan KOENIG (from FRANCE mercredi 6 février 2008 15:50:47)

  • Convert Oracle SQL query to single column output

    Hello All,
    I need to build the query to have multiple columns in a single column with multiple rows.
    select a.customer_trx_id,a.previous_customer_trx_id
    from ra_customer_trx_all a
    where a.customer_trx_id = :customer_trx_id
    here, a.customer_trx_id and a.previous_customer_trx_id are in two columns. I need to bring them into a single column.
    Say: the above output is
    a.customer_trx_id a.previous_customer_trx_id
    123456 87654
    Need to have single column
    As
    123456
    87654
    Please do the needful.
    Thanks,
    Abdul

    Hi,
    Post your question in [SQL and PL/SQL|http://forums.oracle.com/forums/forum.jspa?forumID=75] forum, you would probably get a better/faster response.
    Regards,
    Hussein

  • Multiple row value coming in a single row(nclob)

    hi ,
    i have a requirement where i have to work on a column on datatype nclob, now here the value of 2 rows coming into a single column. like this:
    select distinct extractvalue(xmltype(details),'/Anything/invoiceNumber') as invoices ,
    actinguserid as user_id ,createdt
    from bchistevent where bucket = 201301
    and upper(type) = 'COM.AVOLENT.PRESENTATION.EVENT.INVOICEDOWNLOADEVENT'
    --and    bchistevent.bucket = to_char (add_months (sysdate, -1),'YYYYMM')
    395452969-000-20130103     1.46388193452398E37     1/8/2013 3:05:42 AM
    300000590-000-20090723     1.46388193452398E37     1/11/2013 8:11:45 AM
    300000590-000-20090723     1.46388193452398E37     1/11/2013 8:12:50 AM
    395453127-000-20130103     1.46388193452398E37     1/14/2013 4:44:26 AM
    *300084670-000-20120906, 300084671-000-20120906*     1.46388193452398E37     1/7/2013 12:45:19 AM
    395452626-000-20130103     1.46388193452398E37     1/8/2013 3:03:57 AM
    300084679-000-20120906     1.46388193452398E37     1/11/2013 8:10:47 AM
    300000728-000-20090731     1.46388193452398E37     1/11/2013 8:19:19 AM
    300084679-000-20120906     1.46388193452398E37     1/14/2013 12:31:48 AM
    300000590-000-20090723     1.46388193452398E37     1/14/2013 4:13:19 AM
    395452718-000-20130103     1.46388193452398E37     1/8/2013 7:10:19 AM
    300084679-000-20120906     1.46388193452398E37     1/23/2013 6:54:11 AM
    300084679-000-20120906     1.46388193452398E37     1/22/2013 3:11:54 AM
    300000590-000-20090723     1.46388193452398E37     1/11/2013 8:14:02 AM
    395453127-000-20130103     1.46388193452398E37     1/14/2013 4:33:12 AM
    300084679-000-20120906     1.46388193452398E37     1/22/2013 3:03:36 AM
    300084679-000-20120906     1.46388193452398E37     1/14/2013 12:34:13 AM
    395452997-000-20130103     1.46388193452398E37     1/7/2013 3:31:38 AM
    395452391-000-20121027     1.46388193452398E37     1/3/2013 4:40:05 AM
    and the value of bold highlighted row is coming in a single row, plzz help how to break this in 2 rows??
    Edited by: user1175303 on Mar 13, 2013 5:43 AM

    user1175303 wrote:
    the column value which is in question is <Anything><invoiceNumber>300084670-000-20120906, 300084671-000-20120906</invoiceNumber></Anything> here i am getting 2 values in a single column and because of this i am unable to get desired output...So you have XML issue but trying to resolve it in Oracle??? Why <invoiceNumber> holds two invoice numbers? Anyway:
    with t as (
               select  distinct extractvalue(xmltype(details),'/Anything/invoiceNumber') as invoices,
                       actinguserid as user_id,
                       createdt
                 from  bchistevent
                 where bucket = 201301
                   and upper(type) = 'COM.AVOLENT.PRESENTATION.EVENT.INVOICEDOWNLOADEVENT'
    select  regexp_substr(invoices,'[^,]+',1,column_value) invoices,
            user_id,
            createdt
      from  t,
            table(
                  cast(
                       multiset(
                                select  level
                                  from  dual
                                  connect by level <= length(regexp_replace(invoices,'[^,]')) + 1
                       as sys.OdciNumberList
    /SY.

  • 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

  • How to import multiple Excel/CSV columns into a single Sharepoint metadata choice column?

    Consider: I work for an organization that has eight service territories.  We have a series of procedural documents that can apply to from one to eight territories. We are moving this data over to sharepoint, and I'd like to add territory
    data as metadata. Unfortunately, with our current knowledge management system, the best we can get is 8 separate fields flagged as yes/no.
    is1 is2 is3 is4 is5 is6 is7 is8
    1   0  
    1   1   0  
    0   0  
    0
    0   0  
    0   1   1  
    0   0  
    0
    0   0  
    0   0   0  
    0   1  
    0
    I would like to be able to import this data into a SINGLE sharepoint metadata column as Choice/checkboxes/allow Multiple values. Is there a way to do this? We're using Foundations 2010, and our area does not have access to
    development tools (including SPD).

    Thanks for the reply. We have eight individual Columns in the Excel File, and when we do the import to Sharepoint, yes we get eight individual metadata columns.
    I would LIKE to be able to import the eight columns into ONE column in Sharepoint.
    Consider three documents.
    Doc1 is information applicable to Territories 1,3 & 4.
    Doc2 is information applicable to Territories 4 & 5.
    Doc3 is information applicable to Territory 7.
          is1 is2 is3 is4 is5 is6 is7 is8
    doc1   1   0  
    1   1  
    0   0   0  
    0
    doc2   0   0  
    0   1  
    1   0   0  
    0
    doc3   0   0  
    0   0  
    0   0   1  
    0
    This metadata would import to a SINGLE column in SharePoint called IsTerritory, which is defined as a Checkbox (multiple values) Choice Field, limited to the values 1-8.
    Doc1 would have checkboxes 1,3, & 4 checked, Doc2 would have checkboxes 4 & 5 checked, and Doc 3 would only have checkbox 3 checked.
    Does that make a little more sense? I'm having problems validating my account, so I can't upload screenshots yet...
    Thanks in advance for your reply.

  • How to process multiple rows of data into a single string

    Hello,
    I am trying to process multiple rows of text from an Oracle database into one field to display on a report as continuous text. Below is sample data. The text field is 55 characters wide so anything longer is broken into multiple rows. I need to recombine it for display.
    line          text
    1             IN THE N.E. QUADRANT OF THE INTERSECTION OF THE FAIRFAX
    2              COUNTY PARKWAY AND THE DULLES AIRPORT ACCESS AND THE T
    3             OLL ROAD AND SOUTH OF SUNSET HILLS ROAD
    I tried creating a formula field but it did not work, below is the code in Visual Basic syntax. I also tried using the Maximum() and UBound() functions without luck. I don't quite understand how to make the UBound() work; it threw a lot of errors.
    Dim i As Number
    Dim strLocDesc As String
    For i = 1 To count({LDS_AR_RL_COMM.ART_LINE_NUM})
        strLocDesc = strLocDesc & {LDS_AR_RL_COMM.ART_COMM_RMK}(i)
    Next i
    formula = strLocDesc
    Any ideas on how to solve this?

    Hello Allison,
    You can try this:
    Create a formula called @StoreText, place it in the details and have the following code in it:
    WhilePrintingRecords;
    Global StringVar Text1;
    Global StringVar TextRest;
    if {field.line} = 1 then
    Text1:= {field.text} else
    if {field.line} >= 2 then
    TextRest := TextRest+" "+{field.text};
    In the Group Footer you can have a formula called @GetStoreText with the following code in it:
    WhilePrintingRecords;
    Global StringVar Text1;
    Global StringVar TextRest;
    Text1+varTextRest;
    See how that works out for you.
    Regards,
    Zack

Maybe you are looking for

  • Formatting the Multi-Valued Parameter Selection in report builder 3.0

    Hi All, I have a field from a data set and i assigned it to a parameter that selects multiple values. But i want to format(i need only substring of that field value) the data set field value for the user to select those values. I build a report datas

  • End  user deleted posted MIRO invoice, how?

    Hi SAP Gurus, Surprisingly user was able to delete the posted MIRO invoice (infact a paid invoice) using MIR4, then going to Edit- Display/Change and Invoice document-Delete. I can see the deleted invoice under Purchasing history in the PO but when i

  • F.05 : No more storage space is available for extending  an internal table

    Hi, While executing F.05(FCV), I am getting ABAP Run time Error which is as below Short Text: No more storage space is available for extending  an internal table Pls, Give me solution and get more points. It is very urgent Thanks in advance Akash

  • MacBook Pro Freezing when opening new tab in Safari - MY SOLUTION

    All, I have been battling with a Safari issue for months; I have seen many postings of the same and similar problems. Problem when opening a new tab in Safari the computer completely froze up. Sometimes the curser still moved around but could not sel

  • Russian SAPscript/printing Cyrillic Font

    I have been tasked with looking at the SAPscript side of a Russian implementation. We are using standard HP printers and have a considerable amount of beposke forms from other country implementations to convert to Russian use. I have scoured the web