Get a table from XML with unknown number of columns

Guys, I'm looking if it is possible to get the following result:
imagine I have an XML like one of the following (it doesn't matter which one, I just give a few examples for you to have a choice). The main idea, that there are described several columns and values for 1 row of these columns, e.g.:
SQL> with t as (select
  2  ' <column>
  3    <name>col1</name>
  4    <value>100</value>
  5   </column>
  6   <column>
  7    <name>col2</name>
  8    <value>200</value>
  9   </column>' xml from dual union all
10             select
11  ' <column>col1
12     <value>100</value>
13    </column>
14    <column>col1
15     <value>100</value>
16    </column>' from dual union all
17             select
18  '<col1>100</col1>
19  <col2>200</col2>' from dual)
20             --
21             select * from t
22  /
XML
<column>
  <name>col1</name>
  <value>100</value>
</column>
<column>
  <name>col2</name>
  <value>200</value>
</column>
<column>col1
   <value>100</value>
  </column>
  <column>col1
   <value>100</value>
  </column>
<col1>100</col1>
<col2>200</col2>
SQL> I want to get the following result from this XML:
      COL1       COL2
       100        200So the main idea here is that the number of columns can vary - it is not fixed.
So it is quite similar to dynamic SQL.
Is it possibe with XML?

The only general way to get a flexible amount of columns I know of is to use table functions returning anydataset.
It should be rather straightforward to pass in a xml document and return its tablestructure respectivly (though the »structure« of the xml must be fixed).
Would that be an acceptable way of doing this?

Similar Messages

  • The system says my serial number is invalid while I just bought it online and get a mail from ADOBE WITH THIS NUMBER

    The system says my serial number is invalid while I just bought it and received a mail from Adobe with exact this number?????

    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 |12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7
    Lightroom:  5.7| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.window using the Lightroom 3 link to see those 'Important Instructions'.

  • Separate flattened data with unknown number of columns

    Hi
    I am working on a runbook for a customer which returns the number of windows updates in a software update group and sends an email. Currently only the update title is returned from the SQL query and that activity is flattened with line breaks to give a nice
    format in the email.
    What I would like to be able to do is add the links from the windows updates into the email as well but due to the flatten earlier I can't seem to get the output format right to have the format of:
    updatename, link to update
    for each update returned. I would think some form of .net activity would be able to get around this by putting the data into a table but not sure where to start.
    Thanks

    This is the query that I am using:
    SELECT WinUpdate.Title, WinUpdate.InfoURL FROM v_UpdateInfo UpdateGroup
    INNER JOIN v_CIRelation ON UpdateGroup.CI_ID=v_CIRelation.FromCIID
    INNER JOIN v_updateinfo WinUpdate ON v_CIRelation.ToCIID=WinUpdate.CI_ID
    WHERE UpdateGroup.title = 'Software Update Group Name'
    Which when flattened with line breaks and put into a rich text format email produces:
    Update for Windows Server 2012 (KB2934016);http://support.microsoft.com/kb/2934016
    Update for Windows Server 2012 (KB2928678);http://support.microsoft.com/kb/2928678
    Security Update for Windows Server 2012 (KB2922229);http://support.microsoft.com/kb/2922229
    I've not got a problem getting the information but the email format doesn't have the web links as hyperlinks. Trying to separate them is then a problem as I can't use the Field data manipulation due to not knowing the number of results that are returned.

  • I currently have aT-Mobile sim, and therefore, a UK telephone number. Can I get a sim from EE with the same number to use in my iphone 5?

    I currently have aT-Mobile sim, and therefore, a UK telephone number. Can I get a sim from EE with the same number to use in my iphone 5?

    The easiest way to find out what carrier it's locked to would be to call the store where you purchased the phone.
    The phone can be unlocked from any location.  However, most carrier have restrictions about unlocking and you have to contact them for details.

  • How can i export the data to excel which has 2 tables with same number of columns & column names?

    Hi everyone, again landed up with a problem.
    After trying a lot to do it myself, finally decided to post here..
    I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
    It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
    Because both the tables have same number of columns & column names.
    Below are 2 tables with column names:
    Table-1 (MONTHLY_PART_1)
    Table-2 (MONTHLY_PART_2)
    SL_NO
    SL_NO
    COMP
    COMP
    DUE_DATE
    DUE_DATE
    U-1
    U-1
    U-2
    U-2
    U-4
    U-4
    U-20
    U-20
    U-25
    U-25
    Since both the tables have same column names, I'm getting the following error :
    Error 402 at line 103, column 4
      alias required in SELECT list of cursor to avoid duplicate column names.
    So How can i export the data to excel which has 2 tables with same number of columns & column names?
    Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
    Help me with this please.
    Thank You.

    You'll have to *alias* your columns, not prefix it with the table names:
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id, b.id, a.val1, b.val1, a.val2, b.val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
      for rData in cData loop
    ERROR at line 18:
    ORA-06550: line 18, column 3:
    PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
    ORA-06550: line 18, column 3:
    PL/SQL: Statement ignored
    $[CHE_TEST@asterix1_impl] r
      1  declare
      2    cursor cData is
      3      with data as (
      4        select 1 id, 'test1' val1, 'a' val2 from dual
      5        union all
      6        select 1 id, '1test' val1, 'b' val2 from dual
      7        union all
      8        select 2 id, 'test2' val1, 'a' val2 from dual
      9        union all
    10        select 2 id, '2test' val1, 'b' val2 from dual
    11      )
    12      select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
    13      from data a, data b
    14      where a.id = b.id
    15      and a.val2 = 'a'
    16      and b.val2 = 'b';
    17  begin
    18    for rData in cData loop
    19      null;
    20    end loop;
    21* end;
    PL/SQL procedure successfully completed.
    cheers

  • Table of Content with page number for entire pdf

    Hi
    We need to merge dynamic pdf with n number of static pdf.
    The output of the generated pdf has one of the page called Table Of Content with page number.
    For this we have created following process
    We created a form using Adobe livecycle form designer to populates input data(xml).
    We created process to generate dynamic pdf .
    We have static pdf's in some folder location(Eg:C:\temp)
    We created xsl to generate DDX to merge Dynamic pdf with static pdf's by using an assembler operation in the Process
    There are number of static specification pdf's  inserted in between of dynamic pdf using logic in xsl.
    We used bookmark option in xsl for creating table of content .
    While invoking the process we are able to generate the correct merged pdf with some unformatted page of table of content
    We can explain better in the following way where we are actually facing a challenge:
    We need a table of content in the below mentioned format:
                                                                                                                 PAGE
    MAIN DESCRIPTION                                                                                    n
    ID1             NAME1            DESCRIPTION   1                                              m
    ID2POK       NAME2            DESCRIPTION   2                                              m
    FDJKHJG                                                                                                   
    ID3             NAME3            DESCRIPTION   3                                              m
    MAIN DESCRIPTION2                                                                                 n
    ID3            NAME3            DESCRIPTION   5                                               m
    ID4            NAME4            DESCRIPTION   4                                               m
    ID5            NAME5            DESCRIPTION   5                                               m
    Since the pdf merging and numbering is done  using ddx at runtime, page number tag is not there in xml and  therefore the toc page cannot be populated at the time of form design.
    The issue we are facing is that, by using ddx script we are not able to align id,name,description in  table of content in proper manner. We want to wrap particular id ,name and description in their respective columns.
    Currently, we are getting the below mentioned result which is not in a proper format.
                                                                                                               PAGE
    MAIN DESCRIPTION                                                                                n
    ID1HDSJHJDHFDJFHD            NAME1FDJFHDJH           DESCRIP
    TION 1                                                                                                    m
    ID2POKLFDJKHJG           NAME2FDJKFJDKFJKD            DESCRI
    PTION   2                                                                                                m
    ID3            NAME3            DESCRIPTION   3                                             m
    Note: Page numbering has been done only after merging all the pdf(Dynamic and static) using ddx  instead of the adobe livecycle form designer.
    Is there any solution to resolve the formatting issue or any other option to create table of content dynamically ?

    Hi SaCvP,
    According to your description, you want to display the table of contents with page number in SSRS 2014.
    In Reporting Services, the global variable PageNumber or Totalpages can be only used in the page header and page footer. In your scenario, you can create a table of content using document map, but we can’t specify the expression with PageNumber or Totalpages.
    So your requirement can’t be achieved currently.
    Reference:
    Create a Document Map (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Displaying tables with dynamic number of columns

    Hello,
    I'm pretty new to JSF. Currently I'm working on a project where I have to select a table from a list, and then make it browsable/editable. The problem I have is that the different tables also have a different number of columns.
    I have no problem displaying different tables if the number of coulumns stays the same (using h:datatable) but when it's dynamic, I don't know how I can have my JSP to adjust to support the varying number of columns.
    Has anyone got an example of dynamic datatable or maybe someone can point me in the right direction.
    Brimborian

    Hi daniel,
    1. There is an INDEPENDENT FORM
      whose inputs are FIELD LIST
      and from those, it consructs dynamic table.
    2. Here is the program.
    the dynamic table name will be
    <DYNTABLE>.
    3. U can use this program (FORM in this program)
    to generate any kind of internal table
    by specifying some inputs (ie. field list)
    4.
    REPORT abc.
    COMPULSORY
    FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
    FIELD-SYMBOLS: <dynline> TYPE ANY.
    DATA: lt TYPE lvc_t_fcat.
    DATA: ls TYPE lvc_s_fcat.
    FIELD-SYMBOLS: <fld> TYPE ANY.
    DATA : fldname(50) TYPE c.
    PARAMETERS : infty(4) TYPE c OBLIGATORY.
    DATA : iname LIKE dd02l-tabname.
    START-OF-SELECTION.
    GET INFO
    CONCATENATE 'P' infty INTO iname.
    DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS'
    EXPORTING
    tabname = iname
    TABLES
    ddfields = ddfields.
    CONSTRUCT FIELD LIST
    LOOP AT ddfields.
    ls-fieldname = ddfields-fieldname.
    APPEND ls TO lt.
    ENDLOOP.
    PERFORM
    PERFORM mydyntable USING lt.
    BREAK-POINT.
    INDEPENDENT FORM
    FORM mydyntable USING lt TYPE lvc_t_fcat .
    Create Dyn Table From FC
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
    FIELD-SYMBOLS: <fs_1>.
    FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
    DATA: lt_data TYPE REF TO data.
    ASSIGN lt_data TO <fs_data>.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = lt
    IMPORTING
    ep_table = <fs_data>
    EXCEPTIONS
    generate_subpool_dir_full = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    ENDIF.
    Assign Dyn Table To Field Sumbol
    ASSIGN <fs_data>->* TO <fs_1>.
    ASSIGN <fs_1> TO <fs_2>.
    ASSIGN <fs_1> TO <dyntable>.
    ENDFORM. "MYDYNTABLE
    regards,
    amit m.

  • How create table with variable number of columns?

    I am creating table data in Java. Number of columns is variable. How I can write <table> in UIX.
    Here is code of one of my unsuccessful attempt:
    <provider>
    <!- get table data like DataObjectList-->
    <data name="ReportTableData">
    <method class="app.ReportTableData" method="getTableData"/>
    </data>
    <!- get names of columns like DataObjectList-->
    <data name="ColumnNames">
    <method class="app.ReportTableData" method="getColumnNames"/>
    </data>
    </provider>
    <table data:tableData="@ReportTableData">
    <contents data:childData="@ColumnNames">
    <text data:text="nameColumn"/>
    </contents>
    </table>
    I hoped that I can get cell data by key, where key is name of column. But cells of table contain only names of columns.
    Please help me, where I mistaken?
    Thank you.

    Hi Sergey,
    The UIX table implementation relies on a childData like mechanism internally to iterate over the rows. For instance, when you databind the text attribute of the UINode used to stamp out each column, you are relying on the uix:table iterating over the table data using the data object for the current row when evaluating your column stamp.
    Setting the data:childData attribute on the table's contents element conflicts with UIX's internal iteration over the tableData. For this reason, we don't support specifying a dynamic number of table columns in UIX XML.
    This doesn't mean that you can't do it, there are different strategies. If you've got a finite and known set of columns, you can specify each possible column and then databind the rendered attribute of each one to hide and show it as appropriate. Another, often cleaner approach, is to build this subtree of UINodes in Java code.

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • Table with varying number of columns

    Hello experts,
    my issue:
    I need to print a table with varying number of columns. Depending on if all cells of a certain column are initial the
    whole column should disappear. Hiding is not enough.
    If this columns is in the middle of the table the following columns should move left to fill the gap.
    my approach: (maybe there is an easier one)
    There are 4 different possible situations. My approach was to create 4 different tables with different amount of
    columns. In the interface I fill the table that is really needed from the source table data and fill a flag that characteristics
    the situation, possible values (1,2,3,4).
    In the form I'd like to print the appropriate table depending on the situations.
    my problem:
    How to place all 4 possible tables lying upon each other in the form and print only the needed one depending on the flag value?
    my question:
    Is my approach ok? Or is there an easier one?
    If it is ok. How can I solve the problem regarding printing the right table.
    Thanks in advance!
    Heinz

    Hi Heinz,
    You can handle it with FormCalc Script at initialization.
    Suppose you have a table with name TABLE having a header HEADER and data row DATA:
    TABLE-->HEADER(Cell1...Cell2...Cell3...Cell4)
              --->DATA(Cell1...Cell2...Cell3...Cell4)
    Suppose you want to hide Cell3 for null values, then write below code at initialization of DATA:
    if(DATA[*].Cell3.rawValue eq null)
    then
    DATA[*].Cell3.presence = "hidden"
    HEADER.Cell3.presence = "hidden"
    else
    DATA[*].Cell3.presence = "visible"
    HEADER.Cell3.presence = "visible"
    endif
    Hope it would help.
    Regards,
    Vaibhav

  • How to get string value from xml in JSF??

    In JSF How to get string value from xml, .ini and properties file. I want to get string value from xml or text to JSF

    Just use the appropriate API's for that. There are enough API's out which can read/parse/write XML, ini and properties files. E.g. JAXP or DOM4J for xml files, INI4J for ini files and Sun's own java.util.Properties for propertiesfiles.
    JSF supports properties files as message bundle and resource bundle so that you can use them for error messages and/or localization.

  • How to create a table with varied number of columns?

    I am trying to create a balance table. The colunms should include years between the start year and end year the user will input at run time. The rows will be the customers with outstanding balance in those years.
    If the user input years 2000 and 2002, the table should have columns 2000, 2001, 2002. But if the user input 2000 and 2001, the table will only have columns 2000 and 2001.
    Can I do it? How? Thanka a lot.

    Why did you create a new thread for this?
    How to create a table with varied number of columns?

  • How to get internal table from SAP Data Provider C#

    Hello.
    ABAP:
       DATA: lt_t001 TYPE TABLE OF t001.
       DATA: url(1000) TYPE c.
      SELECT * INTO TABLE lt_t001 FROM t001.
      CALL FUNCTION 'DP_CREATE_URL'
        EXPORTING
          type                 = 'APPLICATION'
          subtype           = 'X-R3TABLE'
        TABLES
          data                 = lt_t001
        CHANGING
          url                    = url
        EXCEPTIONS
          OTHERS           = 4.
    C#:
    using SAPDataProvider;
    using SAPTableFactoryCtrl;
    public void SetDataFromUrl(string url)
                SAPDataProviderClass p = new SAPDataProviderClass();
                p.SetDataFromURL("APPLICATION", "X-R3TABLE", url);
                ISapDPR3Table tbl = p.GetDataAsR3Table("APPLICATION", "X-R3TABLE");
                SAPTableFactoryClass tf = new SAPTableFactoryClass();
                Table tb = (Table)tf.NewTable();
                tb.ISAPrfcITab = tbl.DataTable; // Exception !!!!!!
    How to get internal table from SAP Data Provider ?

    Hi Sergey,
    I'm trying to do the same, have you found a solution to solved it?
    thanks for your help.
    Regards.
    Jonathan

  • Insert data into oracle table from XML file

    I need to insert data into oracle table from XML file
    If anybody handled this type of scenario, Please let me know how to insert data into oracle table from XML file
    Thanks in advance

    The XML DB forum provides the best support for XML topics related to Oracle.
    Here's the FAQ on that forum:
    XML DB FAQ
    where there are plenty of examples of shredding XML into Oracle tables and such like. ;)

  • SSRS - Table of Contents With Page Number

    Hi! 
    Is it possible to create a table of contents in SQL Server Reporting Services 2014 with the following aspect:
    <w:sdt docparttype="Table of Contents" docpartunique="t" id="1230267000" sdtdocpart="t">
    Contents<w:sdtpr></w:sdtpr>
    Report 1.............................1
    Report 2.............................2
    Report 3.............................3
    </w:sdt>
    I don't want Hyperlink because this report is to be used printed. I have some urgency in this question. 
    Thank you for help!!!

    Hi SaCvP,
    According to your description, you want to display the table of contents with page number in SSRS 2014.
    In Reporting Services, the global variable PageNumber or Totalpages can be only used in the page header and page footer. In your scenario, you can create a table of content using document map, but we can’t specify the expression with PageNumber or Totalpages.
    So your requirement can’t be achieved currently.
    Reference:
    Create a Document Map (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

Maybe you are looking for

  • IPhone 4 went to update in iTunes, error message popped up and now iTunes refuses to recognize the phone

    The other day my iMesasges stopped working so I plugged my phone into my laptop (windows) to update through iTunes. I tried to update it, but when the update was almost done an error message popped up. Now the phone will only turn on with the plug in

  • External hard drive doesn't work on iMac, does work on PC

    Hi everyone. I have an external hard drive which is formatted with ExFat. I recently put all my stuff on it as my MacBook Pro was sent to repair. So it obviously works with OSX. I also put stuff from my PC, and have tested it several times. Compatiba

  • Recon Account not updating while in MIRO

    Hi all.. Im facing the problem: Recon account is not updating  while during the MIRO. even though Vendor account is get updated and i have checked in vendor master also the same account has been maintained. Thanks In advance Akhil

  • Posting value to  material

    Dear friends i have a requirement as follows - we have a vendor to whom the PO is raised and then we have a middleman/commission agent who gets a percentage of the amount from the PO net value. we need to have the provision in SAP for the payment of

  • How to create diagonal variable line pattern in CS6?

    Hi guys I'm on the brink of insanity with creating my diagonal line pattern. I've tried everything I can think of but the pattern is an absolute mess! I want to create a diagonal line pattern but I want the lines not to be uniform. Basically I've mad