Is it possible to convert a table of values into a comma-delimited-list?

Hi,
I'd like to turn the following dataset:
Parent | Child
Charles | William
Charles | Harry
Anne | Peter
Anne | Zara
Andrew | Beatrice
Andrew | Eugenie
into this:
Parent | Children
Charles | Diana,Camilla
Anne | Peter,Zara
Andrew | Beatrice,Eugenie
In other words, I'd like to take a list of values pertaining to some key and produce them as a comma-delimited-list.
I know its is possible in T-SQL although the method is a bit of a nasty hack. Is it possible in PL-SQL?
Thaks in advance
Jamie

Hi,
With model clause (10g)
with t  as(
select 'Charles' parent, 'William' child from dual union
select 'Charles', 'Harry' from dual union
select 'Anne', 'Peter' from dual union
select 'Anne', 'Zara' from dual union
select 'Andrew', 'Beatrice' from dual union
select 'Andrew', 'Eugenie' from dual
select parent,substr(res,2) res
from t
model
return updated rows
partition by ( parent)
dimension by ( row_number()over(partition by parent order by child) rn)
measures(child, cast( null as varchar2(4000)) as res)
rules
iterate(100000)
until(presentv(res[iteration_number+2],1,0)=0)
( res[0]=res[0]||','||child[iteration_number+1]);
PARENT  RES                                              
Anne    Peter,Zara                                       
Andrew  Beatrice,Eugenie                                 
Charles Harry,William                                    
3 rows selected.

Similar Messages

  • Use PL/SQL Table values as a comma delimited list in a in (...) clause

    Hi,
    One my procedure's parameters is a PL/SQL table of id's (NUMBER) that the GUI sends it, based on the user's selections.
    Now, I want to use the table's values in my select's where clause to return only the correct records.
    However,
    select ......
    from ....
    where id in (i_array_ids)
    doesn't work of course, and my attempts of transfering the ids to a comma delimited list of numbers (as opposed to a lenghty varchar2 string) that could work between the ( ) have all failed.
    Thanks

    And here's an example I gave with some more up-to-date syntax than in that old AskTom thread:
    Re: DYNAMIC WHERE CLAUSE in PROCEDURE

  • How to populate custom table field value into standard DFF

    Hi Gurus
    I am newbie to the OAF
    I have a requirement to populate the custom table field value into standard DFF. we enabled the DFF in ReqDistDFFOnAcct(po_req_distributions_all). On the requisition tab as soon as i click on the checkout button, the custom field value has to be shown in the requisition distributions DFF field along with the standard Columns like charge account, percent, qty and when we click on the next button, it has to hit the base table ie., po_req_distributions_all.
    the standard columns data is showing the screen. how to acheive this requirement programatically
    There is a EO for the req distributions table. please help me how to achevie this requirement.
    Any help woud be greatly appreciated.
    Thank You!
    Krishna

    Thanks Aj. Finally i made some progress....but i am getting an error in the inst_top OPMN folder 10/10/08 15:37:14 Error: <connector name="OracleASjms" path="OracleASjms.rar" /> will not be bootstrapped since corresponding module declaration was not found in application.xml. I cleared the cache, bounced the webserver. Could not able to understand what is this error
    Following is the code that i have written. I am not able to find out what is the error. please help me how to fix this error. there is no changes in the page and the value is not auto populating. the page is having the normal behaviour as the standard one.
    Thanks in Advance for your help...
    public class xxCheckoutDistsCO extends CheckoutDistsCO
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    String UnitId="";
    //First get the Application Module
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    OAViewObject vo = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");
    String Reqlineid="";
    String Linenum="";
    String DeliverLoc="";
    if(vo.first() !=null)
    Reqlineid= vo.first().getAttribute("RequisitionLineId").toString();
    Linenum = vo.first().getAttribute("LineNum").toString();
    DeliverLoc = vo.first().getAttribute("DeliverToLocationId").toString();
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", Reqlineid,1);
    // pageContext.writeDiagnostics("TEST >", Linenum,2);
    // pageContext.writeDiagnostics("TEST >", DeliverLoc,3);
    UnitId=null;
    String Querry="select amli_icx_oaf_utils.get_blding_unit_id (?,?,?) from dual";
    try
    PreparedStatement ps=am.getOADBTransaction().getJdbcConnection().prepareStatement(Querry);
    ps.setInt(1,Integer.parseInt(Reqlineid));
    ps.setInt(2,Integer.parseInt(Linenum));
    ps.setInt(3,Integer.parseInt(DeliverLoc));
    ResultSet rs=ps.executeQuery();
    // ps.execute();
    // am.getOADBTransaction().commit();
    while (rs.next())
    System.out.println(" Query Results ");
    UnitId= rs.getString(1);
    System.out.println(" first > ");
    rs.close();
    ps.close();
    catch(SQLException a)
    System.out.println(" Error "+a);
    System.out.println(" Second > ");
    System.out.println(" Third > "); ----the program is executing upto here...it is not setting the value after this.
    OAViewObject povo = (OAViewObject)am.findViewObject("PoReqDistributionsVO");
    if(povo.getCurrentRow()!=null ) --------If i remove this condition i am getting the nullpointer exception in page.....
    System.out.println(" Fourth > ");
    povo.getCurrentRow().setAttribute("Attribute12",UnitId);
    // if(pageContext.isLoggingEnabled(OAFwkConstants.STATEMENT))
    // pageContext.writeDiagnostics("TEST >", UnitId, 1);
    Thanks
    krishna

  • Is it possible to allow use to type entry into a drop down list box ?

    Hi ,
    Is it possible to provide  type in the value option ( provide option to user like he can select a value from the extracted data in a drop down list object and also he can enter a value manually ) to a drop down list box on an interactive form ?
    Nanda

    Hello Nanda,
    In the Adobe LiveCycle Designer you can specify several list items for objects of type 'Drop-down List' and it is also possible to allow custom entries (checkbox: "Allow Custom Text Entry").
    Regards,
    Philipp

  • How to Populate table using values from a muti-select list

    I have a muti-select list in a page, the user can select some of the values from the muti-select list. How to populate a table in a process using the selected values.
    Thanks.
    XP

    XP,
    you can also have a look at the following thread.
    Re: Shuttle Control In APEX 3
    Patrick
    My APEX Blog: http://inside-apex.blogspot.com
    The ApexLib Framework: http://apexlib.sourceforge.net
    The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

  • Convert one single Unscaled value into a Scaled value? Vice-versa?

    Tried to infer from Convert Unscaled to Scaled.VI, but it didn't seem immediately clear.

    Hi,
    examples >> DAQmx >> Measuring Voltage >> scroll to bottom of box. I think my problem is that it requires timing information to do the calculation (the sampling rate is contained in a "header"). I am writing data that is sampled at two different rates (slow rate when data is uninteresting, high rate when data is interesting), so any sort of timing calculation will be distorted. I'm trying to figure out what the amplitude scaling calculation is, but it doesn't seem quite clear to me. Some sort of logarithmic calculation?
    -clay

  • How i pass table column  value to string variable or return to java applete

    Hi Master,
    How do I pass a table column value into string variable. See my code below:
    import java.sql.*;
    public class Waheed {
    public Waheed() {
    public static void main (String args [])
    String s = "9 23 45.4 56.7";
    System.out.println ("going for connection");
    // DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select accid from accbal");
    System.out.println ("going for connection");
    while (rset.next())
    s= rset.getString("accid"); this line give me error
    System.out.println (rset.getString("accid"));
    System.out.println (s);
    catch(Exception e){
    e.printStackTrace();
    This line give me an error:
    s= rset.getString("accid");
    s is string variable
    Plese give me an idea how I can pass accid in s variable.
    Thanks.
    Aamir

    See the code sample in the following thread (try using upeercase).
    JDBC  connection
    Kuassi

  • How to convert PM Module Breakdown Duration (AUSZT) floating point value into Minutes

    Hi Frnds,
    My requirement is to display a normal alv report. Out of which one of the filed is from VIQMEL-AUSZT (Breakdown Duration).
    Which is of Data type FLTP.
    Details:
    AUZTV
    AUZTV
    TIMS
    6
    Start of Malfunction (Time)
    12:39:19
    AUZTB
    AUZTB
    TIMS
    6
    End of Malfunction (Time)
    12:42:00
    AUSZT
    AUSZT
    FLTP
    16
    Breakdown Duration
    1.6100000000000000E+02
    Now I want to convert the value '1.6100000000000000E+02' into Minutes.
    Kindly let me know the solution.
    Note: I tried with standard FM 'PM_TIME_CONVERSION' and converted the break down value into hours.
    For example: 1.6100000000000000E+02 to 4,472222222222222E-02.
    But i want to convert the break down duration value into perfect minutes.
    With Regards,
    Sudhir.

    Simply equate to a variable of type P decimals zero. It should give you value in seconds. Divide it by 60 to have it in minutes.

  • Is it possible to convert ascii data in binary?

    Hi all.
    In my one table there is a column which contains ascii value. i want to convert it in binary. It it possible in oracle?
    eg field value:1250ÿ it should be 125011111111
    kindly tell how to do this.
    i have tried this using a simple java program but doesnot work for some ascii values.
    thank you

    I created two functions :
    create or replace FUNCTION dec2bin (N IN NUMBER) RETURN VARCHAR2 IS
    binval VARCHAR2(64);
    N2 NUMBER := N;
    BEGIN
    WHILE ( N2 > 0 ) LOOP
    binval := MOD(N2, 2) || binval;
    N2 := TRUNC( N2 / 2 );
    END LOOP;
    RETURN binval;
    END dec2bin;
    And other :
    create or replace function to_ascii( inSource IN VARCHAR2 )
    return varchar2 AS
    ResultString varchar2(381); -- 3 * possible length of source
    TempNumber number;
    begin
    for i in 1..length( inSource ) loop
    TempNumber := dec2bin ( ascii( substr( inSource,i,1 ) ) );
    ResultString := ResultString || trim( to_char(TempNumber,'00000009'));
    end loop;
    return ResultString;
    end;
    Now, in sqlplus : (just to show the binary string)
    column mybin for 9999999999999999999999999999999999999999
    SQL> select to_ascii('g') mybin from dual;
    MYBIN
    01100111
    SQL> select to_ascii('girish') mybin from dual;
    MYBIN
    011001110110100101110010011010010111001101101000
    SQL>Source:http://psoug.org/snippet/Convert-between-Decimal-Binary-Octal-and-Hex_536.htm
    http://www.dbforums.com/oracle/974944-converting-string-binary.html
    Is this you want or something else ?
    Regards
    Girish Sharma

  • Is it possible to convert HTML to XML in as2?

    Hi,
    I am trying to develop a stock widget to use in my mobile using flashlite 2.x.
    I have chosen "http://charting.nasdaq.com" to obtain 5days chart /6months chart..
    But I am not able to use XML object for this and parse.. The values are in table format.. So I have to use LoadVars.. but writing a AS2 code
    to obtain values like High/Low price of the stock or volume is very lengthy since the data obtained are not in XML format..
    i tried this
    var example_xml:LoadVars = new LoadVars();
    example.ignoreWhite = true;
    example_xml.load("http://charting.nasdaq.com/ext/charts.dll?2-1-14-0-0-75-03NA000000www-&SF:4|5-WD=539-HT=39 5--XTBL-");
    example_xml.onLoad = function(success) {
         if (success == true) {
              trace(example_xml);
    Is it possible to convert them to xml and use relevent methods or xml properties?
    If I use example_xml:XML = new XML() then tracing example_xml (as above) doesn't give any data
    Any help?

    I had a project a few years ago where I converted 10s of thousands of TestStand HTML files from TS 1.0 and 3.0.
    Most of what I did is specific to our internal data structures, but I'll try to help get you started.
    The general idea is to pick out the report header and data sections from each file, then eliminate the HTML formatting.
    The attached file will extract the Report Header and data sections.
    To use this, you will need to download this additional VI that I posted here in the regex board a few years ago.
    http://forums.ni.com/t5/BreakPoint/Regular-Expressions-Board/m-p/1269088#M14343
    Here is one more file that will parse out each data record and dtermine it's Name, status, type value, limits and duration/timestamp info
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness
    Attachments:
    Parse TestStand HTML.vi ‏42 KB
    Parse TestStand HTML Data Section.vi ‏55 KB

  • ExportPDF does a poor job when converting pdf tables to MS Excel tables - Any advice?

    ExportPDF does a poor job when converting pdf tables to MS Excel tables.
    The resulting file had several lines merged into one and had strange font sizes and line heights and widths.
    If needed, I can send both files to show what happened.
    I am using Adobe Reader 10.1.4, with Adobe ExportPDF (unknown version, bought Oct 4, 2012), MS Excel for Mac 2011, version 12.2.2 (120421) on a MacBook Air with Mac OS X version 10.7.4.
    Best regards,
    Pedro

    I have the same problem. I would like to convert bank statements to Excel but am only interested in the transaction history. Is it possible to select only certain parts of the document as a template for other conversions?

  • Is it possible to convert JPG to BMP within SAP ?

    Hi SAP Friends,
    We would like to know if it possible to convert JPG to BMP within SAP ? Our users upload jpg file in custom Z transaction and we store that JPG file in Custom Cluster table. Now, we need to get this JPG file, convert it into BMP and store it in SE78. You may ask, why dont we ask users to upload directly in SE78 ?  Our Custom Z transaction does other things, so we cannot ask users to use SE78 and also they get jpg files and not BMP files. So, we need to do conversion internally.
    Any ideas ?
    Niranjan

    Hi Niranjan,
    Unfortunately we cannot.
    Regards
    Aneesh.

  • Is it possible to convert an app from 12c to 11g?

    I am using both 11.1.2.4 and 12.1.2.0.
    If I have an app built with 12.1.2.0, which does not include any 12c specific features, is it possible to convert it to 11.1.2.4?
    I am asking because I have a Development environment that is 12c, but a Production environment that is 11g and I am not sure we will be able to upgrade the Production environment
    Thanks in advance..

    It's possible but not an easy task. As 12c uses newer stuff you have to test everything with great care. You might find some things you have to rebuild add they won't work in 11.1.2.4.0 (e.g. components which are only available in 12c. If you read the what's new doc for 12c and you find something you have used, prepare to rebuild this part.
    First thing to try ids to open the project in 11.1.2.4.0 and see if you can compile and run the app.
    Timo

  • Is it possible to convert text captions to Smart Shapes?

    Hello,
    I have a collegue that is using Cp 5 to record software simulations which then need to be brought into Cp6. The problem is that our standards (for software simulations) employ Smart Shape call outs (not the Cp 5.5 and earlier text captions).
    Is it possible to convert these text captions into our themed Smart Shapes either automatically inside Captivate 6 or by modifying the content within the CPTx file?
    Thank you,
    Shawn

    Hello Lilybiri,
    As always you are awesome! :-)
    >I don't believe an automatic switch will be possible, because smart shapes are totally different objects.
    I understand because there are a huge variety of shapes in either format. But I suspect that it should be easy to convert a text caption from any style to one specified smart shape style.
    Actually, I am asking before the simulations get started. So nothing has been done yet. I am unsure what you are suggesting I should do in the preferences under Cp 5.5. Are you suggesting that there is a way to convert 'some format' of text callouts, in a Cp5.5 demonstration simulation, to Smart Shapes in Cp6?
    >but since you already have created the simulations, it has to be done manually. Hoping for you that
    >someone has a bright idea, but I do not see one immediately.
    For anyone else in this situation, it would be handy to have a solution (rather than painstakingly convert each manually).
    I am wondering if this might be a relatively easy search/replace within one of the xml files within the CPTx file. I'm going to look at this tonight.
    Thanks for your assist.

  • Is it possible to convert PDF file into HTML

    Dear friends
    Is it possible to convert PDF file into HTML. I have few hundread PDF files i like to convert this files into HTML. I hope it can be done through Java but i don't know how to start this coding. anybody can give me a brief idea to go ahead.

    Why do you want to do this yourself? I quick search on Google showed several utilities to do this, some freeware, some commercial.

Maybe you are looking for