Problem reading a xmlType column (return only 999 rows) with XMLTable

Hello,
I'm new in the forum.
Sorry for my english.
I have a problem reading an xmltype column.
My oracle's version is 11.1.0.6.0
I have a table like this:
Create Table TestXml (idProg number, xmldata XmlType)
XMLTYPE COLUMN xmldata
STORE AS BINARY XML;
I have a xml file containing the equivalent of 10000 record (like a csv).
my schema xsd is the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:element name="applicazione">
          <xs:annotation>
               <xs:documentation>Flusso Monitoraggi</xs:documentation>
          </xs:annotation>
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="periodo" maxOccurs="unbounded">
                         <xs:complexType>
                              <xs:sequence>
                                   <xs:element name="segmento" maxOccurs="unbounded">
                                        <xs:complexType>
                                             <xs:sequence>
                                                  <xs:element name="progressivo" maxOccurs="unbounded">
                                                       <xs:complexType>
                                                            <xs:sequence>
                                                                 <xs:element name="stato" type="xs:string"/>
                                                                 <xs:element name="ts_start" type="xs:string"/>
                                                                 <xs:element name="ts_stop" type="xs:string"/>
                                                                 <xs:element name="nota_esecuzione" type="xs:string"/>
                                                                 <xs:element name="ts_esecuzione" type="xs:string"/>
                                                            </xs:sequence>
                                                            <xs:attribute name="valore" type="xs:integer" use="required"/>
                                                       </xs:complexType>
                                                  </xs:element>
                                             </xs:sequence>
                                             <xs:attribute name="nome" type="xs:string" use="required"/>
                                        </xs:complexType>
                                   </xs:element>
                              </xs:sequence>
                              <xs:attribute name="nome" type="xs:string" use="required"/>
                         </xs:complexType>
                    </xs:element>
               </xs:sequence>
               <xs:attribute name="nome" type="xs:string"/>
          </xs:complexType>
     </xs:element>
</xs:schema>
When I try to read my xmltype column with this select :
SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
sg.desc_segmento_elab,pg.seq_progressivo,
pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
pg.valore_prog,sg.seq_segmento,idProg
FROM testXML p,
XMLTable('/applicazione' PASSING p.xmlData
COLUMNS
seq_applicazione for ordinality,
desc_applicazione VARCHAR2(50) PATH '@nome',
periodo XMLType PATH 'periodo') ap,
XMLTable('periodo' PASSING ap.periodo
COLUMNS
seq_periodo for ordinality,
desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
segmento XMLType PATH 'segmento') pe,
XMLTable('segmento' PASSING pe.segmento
COLUMNS
seq_segmento for ordinality,
desc_segmento_elab VARCHAR2(50) PATH '@nome',
progressivo XMLTYPE PATH 'progressivo') sg,
XMLTable('progressivo' PASSING sg.progressivo
COLUMNS
seq_progressivo for ordinality,
valore_prog NUMBER PATH '@valore',
desc_stato VARCHAR(10) PATH 'stato',
ts_start VARCHAR2(50) PATH 'ts_start',
ts_stop VARCHAR2(50) PATH 'ts_stop',
nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
) pg
where idProg = 1
I obtained only 999 rows.
I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
Anybody know why? Where is my error?
Thank you in advance for any response.
Maurizio

Hello,
I'm new in the forum.
Sorry for my english.
I have a problem reading an xmltype column.
My oracle's version is 11.1.0.6.0
I have a table like this:
Create Table TestXml (idProg number, xmldata XmlType)
XMLTYPE COLUMN xmldata
STORE AS BINARY XML;
I have a xml file containing the equivalent of 10000 record (like a csv).
my schema xsd is the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:element name="applicazione">
          <xs:annotation>
               <xs:documentation>Flusso Monitoraggi</xs:documentation>
          </xs:annotation>
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="periodo" maxOccurs="unbounded">
                         <xs:complexType>
                              <xs:sequence>
                                   <xs:element name="segmento" maxOccurs="unbounded">
                                        <xs:complexType>
                                             <xs:sequence>
                                                  <xs:element name="progressivo" maxOccurs="unbounded">
                                                       <xs:complexType>
                                                            <xs:sequence>
                                                                 <xs:element name="stato" type="xs:string"/>
                                                                 <xs:element name="ts_start" type="xs:string"/>
                                                                 <xs:element name="ts_stop" type="xs:string"/>
                                                                 <xs:element name="nota_esecuzione" type="xs:string"/>
                                                                 <xs:element name="ts_esecuzione" type="xs:string"/>
                                                            </xs:sequence>
                                                            <xs:attribute name="valore" type="xs:integer" use="required"/>
                                                       </xs:complexType>
                                                  </xs:element>
                                             </xs:sequence>
                                             <xs:attribute name="nome" type="xs:string" use="required"/>
                                        </xs:complexType>
                                   </xs:element>
                              </xs:sequence>
                              <xs:attribute name="nome" type="xs:string" use="required"/>
                         </xs:complexType>
                    </xs:element>
               </xs:sequence>
               <xs:attribute name="nome" type="xs:string"/>
          </xs:complexType>
     </xs:element>
</xs:schema>
When I try to read my xmltype column with this select :
SELECT ap.desc_applicazione,pe.seq_periodo, pe.desc_elem_temp_ist,
sg.desc_segmento_elab,pg.seq_progressivo,
pg.desc_stato,pg.ts_start,pg.ts_stop,pg.nota_esecuzione,pg.ts_esecuzione,
pg.valore_prog,sg.seq_segmento,idProg
FROM testXML p,
XMLTable('/applicazione' PASSING p.xmlData
COLUMNS
seq_applicazione for ordinality,
desc_applicazione VARCHAR2(50) PATH '@nome',
periodo XMLType PATH 'periodo') ap,
XMLTable('periodo' PASSING ap.periodo
COLUMNS
seq_periodo for ordinality,
desc_elem_temp_ist VARCHAR2(50) PATH '@nome',
segmento XMLType PATH 'segmento') pe,
XMLTable('segmento' PASSING pe.segmento
COLUMNS
seq_segmento for ordinality,
desc_segmento_elab VARCHAR2(50) PATH '@nome',
progressivo XMLTYPE PATH 'progressivo') sg,
XMLTable('progressivo' PASSING sg.progressivo
COLUMNS
seq_progressivo for ordinality,
valore_prog NUMBER PATH '@valore',
desc_stato VARCHAR(10) PATH 'stato',
ts_start VARCHAR2(50) PATH 'ts_start',
ts_stop VARCHAR2(50) PATH 'ts_stop',
nota_esecuzione VARCHAR2(50) PATH 'nota_esecuzione',
ts_esecuzione VARCHAR2(50) PATH 'ts_esecuzione'
) pg
where idProg = 1
I obtained only 999 rows.
I tried with two file xml, one containing 10000 repetition of progressivo, the other containing 10000 repetition of segmento.
Anybody know why? Where is my error?
Thank you in advance for any response.
Maurizio

Similar Messages

  • Power Query occassionally connects, seems to load, but returns only 200 rows with 1 error

    I have a Power Query that i have used for few weeks, successfully, but occasionally requires being run a few times to return records.  Just lately it seems to require run more than a few times to make it work. 
    When it doesn't return records , it seems to connects and start retrieving data, but returns only randomly like 100 - 200 rows with 1 error.  The error doesn't have any message. So its hard to troubleshoot from that perspective.
    Query appends two other large and merges in a few others. The data sources are either csv files, Sharepoint Lists and tables in workbook.
    I haven't identified anything in terms of environment or query changes that might cause this.
    When it finally does retrieve all records,  it might be after i have done the following things, but i can't say for certain exactly what did the trick:
    * to run query multiple times
    *maybe simply changing anything in query resolves issue
    * making upstream queries (that are merged or appended into this query)  to Not Load to worksheet or model, eg just have connection
    I'd think this type of error and situation while not common is encountered by others.
    Does this ring a bell for anyone, and if so, can you please shed some light on the reasons and resolutions for this?
    Thanks!

    If you click on "1 error" it should show the editor with a query that will select the rows with errors. This unfortunately might not show all errors for various reasons, but you should try it.
    If that doesn't work, here's an example of how to retrieve error details.
    Suppose the following query:
    = Table.FromRecords({[A="B", B="C" + 1]})
    Notice how we're using the + operator with a string and number. This will result in an error.
    I can create a custom column that uses the 'try' operator over the B column. This returns a record with details which I then expand to retrieve the message.
    let
    Source = Table.FromRecords({[A="B", B="C" + 1]}),
    #"Added Custom" = Table.AddColumn(Source, "Custom", each try [B]),
    #"Expand Custom" = Table.ExpandRecordColumn(#"Added Custom", "Custom", {"HasError", "Error"}, {"Custom.HasError", "Custom.Error"}),
    #"Expand Custom.Error" = Table.ExpandRecordColumn(#"Expand Custom", "Custom.Error", {"Message"}, {"Custom.Error.Message"})
    in
    #"Expand Custom.Error"
    Let me know how this works for you.
    Tristan

  • Select only the row with the latest updatedate

    Hi to All !
    Can anyone help me with this problem. If I want to select from the existing table:
    ROWNUM:UPDATEDATE:NUMBER:UNIT:LOC:ONHAND:DESC:LOTEXP:EXTRACTIONDATE
    6     106102     81016     CH9     ADMEIER     2     C4D84M          106104
    5     106102     81016     CH9     ADMEIER     2     C4D84M     111030     106103
    4     106102     81016     CH9     ADMEIER     2     C4D84M     111030     106102
    3     106101     81016     CH9     ADMEIER     4     C4D84M     111030     106100
    2     106081     81016     CH9     ADMEIER     0     C4D04Y          106100
    1     106073     81016     CH9     ADMEIER     1     A4AU8W          106100
    only the rows with the latest updatedate, results in : (row number 3,4,5 have to be out)
    ROWNUM:UPDATEDATE:NUMBER:UNIT:LOC:ONHAND:DESC:LOTEXP:EXTRACTIONDATE
    6     106102     81016     CH9     ADMEIER     2     C4D84M          106104
    2     106081     81016     CH9     ADMEIER     0     C4D04Y          106100
    1     106073     81016     CH9     ADMEIER     1     A4AU8W          106100
    Any Ideas ? Thanks in advance Thomas

    The select for the colums looks like:
    UPDATEDATE, NUMBER, UNIT, LOC, ONHAND, DESC, LOTEXP, EXTRACTIONDATE
    The table has the following unique key:
    UPDATEDATE, NUMBER, UNIT, LOC, LOTEXP, EXTRACTIONDATE
    how I have to use now PARTITION BY to get for each row the latest updatedate ?
    Thomas

  • I want to read and assign value of ADF Table rows  with Java Script

    Hi,
    I want to read and assign value of ADF Table rows with Java Script, but I cant true index of current row , so I assign wrong value to anathor column of ADF Table.
    My Code;
    ADF Table items
    <af:column sortProperty="Adet" sortable="false"
    headerText="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.labels.Adet}"
    binding="#{backing_ucret.column2}" id="column2">
    <af:inputText value="#{row.Adet}"
    required="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.attrDefs.Adet.mandatory}"
    columns="10"
    binding="#{backing_ucret.inputText2}"
    id="inputText2" onchange="getTutar('#{bindings.voHarcamaOdeme1Iterator.rangeStart + bindings.voHarcamaOdeme1Iterator.currentRowIndexInRange + 1}','#{bindings.voHarcamaOdeme1Iterator.estimatedRowCount}','#{row.index}')">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.formats.Adet}"/>
    </af:inputText>
    </af:column>
    MY JAVA SCRIPT CODE
    <f:verbatim>
    <script language="javascript" type="text/javascript">
    function getTutar(rowkey,totalrow,currentRow){
    alert('rowkey--totalRow--currentRow-->'+rowkey+'--'+totalrow+'--'+currentRow);
    if (currentRow==0) {
    rowkey=totalrow-1;
    }else{
    var rw=totalrow-currentRow-1;
    rowkey=rw;
    alert(document.getElementById('form1:table1:'+rowkey+':inputText8').value);
    alert(document.getElementById('form1:table1:'+currentRow+':inputText8').value);
    var birim_ucret=document.getElementById('form1:table1:'+rowkey+':inputText8').value;
    var adet=document.getElementById('form1:table1:'+rowkey+':inputText2').value;
    document.getElementById('form1:table1:'+rowkey+':inputText3').value=birim_ucret*adet;
    document.getElementById('form1:inputText6').value=0;
    var t;
    var toplam=0;
    alert('before Sum');
    for (var i=0;i!=totalrow-1;i++){
    t = document.getElementById('form1:table1:'+i+':inputText3');
    toplam+=t.value*1;
    document.getElementById('form1:inputText6').value=toplam;
    </script>
    </f:verbatim>

    You can achieve the use case you describe with partial page rendering (PPR), a feature of the ADF Faces framework. Here are a few posts that achieve an interactive behavior using PPR. Off the top of my head I do not know of an exact example, but this should be a good starting point:
    http://thepeninsulasedge.com/blog/2006/09/12/adf-faces-aftableselectmany/
    http://thepeninsulasedge.com/blog/2006/08/31/adf-faces-working-with-aftableselectone-and-the-dialog-framework/
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Condition that takes only one row with the maximum cost of the maximum date

    I have to the following query
    SELECT distinct b.segment1 ||'.'|| b.segment2 as ITEM,
           so.vendor_site_id as SUPPLIER,
           'VE' as ORIGIN_COUNTRY_ID,
           replace(round(l.mto_costo_neto/l.can_unidades_empaque,2),',','.') as UNIT_COST,
           5 as lead_time,
           null as pickup_lead_time,
           l.can_unidades_empaque as supp_pack_size,
           1 as inner_pack_size,
           'C' as round_lvl,
           50 as ROUND_TO_INNER_PCT,
           50 as ROUND_TO_CASE_PCT,
           50 as ROUND_TO_LAYER_PCT,
           50 as ROUND_TO_PALLET_PCT,
           null as MIN_ORDER_QTY,
           null as MAX_ORDER_QTY,
           'FLAT' as PACKING_METHOD,
           'N' as PRIMARY_SUPP_IND,
           'Y' as PRIMARY_COUNTRY_IND,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as DEFAULT_UOP,
           1 as TI,
           1 as HI,
           null as SUPP_HIER_TYPE_1,
           null as SUPP_HIER_LVL_1,
           null as SUPP_HIER_TYPE_2,
           null as SUPP_HIER_LVL_2,
           null as SUPP_HIER_TYPE_3,
           null as SUPP_HIER_LVL_3,
           null as CREATE_DATETIME,
           null as LAST_UPDATE_DATETIME,
           null as LAST_UPDATE_ID,
           case when b.primary_unit_of_measure like '%KG%' then 'KG'
                when b.primary_unit_of_measure like '%Kg%' then 'KG'
                when b.primary_unit_of_measure like '%UND%' then 'EA'
                when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                when b.primary_unit_of_measure = 'Litro' then 'L'
                when b.primary_unit_of_measure = 'Unidad' then 'EA'
                else null
           end as COST_UOM,
           null as TOLERANCE_TYPE,
           null as MAX_TOLERANCE,
           null as MIN_TOLERANCE
    FROM mrp.mrp_sr_assignments sr , MRP.MRP_SR_RECEIPT_ORG ro , MRP.MRP_SR_SOURCE_ORG so,
         inv.mtl_system_items_b b, lcm.cmp_lineas_cotizacion l
    WHERE sr.SOURCING_RULE_ID = ro.SOURCING_RULE_ID
          and ro.SR_RECEIPT_ID = so.SR_RECEIPT_ID
          and sr.inventory_item_id in ((select inventory_item_id  from TMP.VIVERES_VEGETALES)
                                      UNION ALL
                                      (select inventory_item_id  from TMP.GENERICOS)
                                      UNION ALL
                                      (select inventory_item_id from TMP.HIJOS_GENERICOS))
          and sr.inventory_item_id = b.inventory_item_id
          and b.organization_id = 136
          and sr.inventory_item_id = l.cod_producto_idI need to agregate the following condition
    For example, The following query
    SELECT l2.fec_ini_vigencia_costo, l2.mto_costo_neto, l2.can_unidades_empaque, l2.cod_producto,
           REPLACE(ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2),',','.')  costo_unidad
    from cmp_lineas_cotizacion l2
    order by cod_producto, fec_ini_vigencia_costo desc, mto_costo_neto descgenerate
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO      COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS ONE
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    23/03/2009     373.2072     12     1.1000008     31.1
    23/03/2009     373.2072     12     1.1000008     31.1I need to take only one row with the maximum FEC_INI_VIGENCIA with the maximum COSTO_UNIDAD of the table lcm.cmp_lineas_cotizacion l, which is calculated with the formula ROUND(l2.mto_costo_neto/l2.can_unidades_empaque,2)

    A better example
    I need only one row the maximum COSTO_UNIDAD for the maximum FEC_INI_VIGENCIA for every cod_producto_id in the table lcm.cmp_lineas_cotizacion
    I need to take these values
    FEC_INI_VIGENCIA_COSTO     MTO_COSTO_NETO     CAN_UNIDADES_EMPAQUE     COD_PRODUCTO_ID  COSTO_UNIDAD
    17/06/2010     382.56     12     1.1000008     31.88 -- THIS!
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     382.56     12     1.1000008     31.88
    17/06/2010     371.0832     12     1.1000008     30.92
    17/06/2010     371.0832     12     1.1000008     30.92
    18/05/2009     382.56     12     1.1000008     31.88
    04/05/2009     245.82     12     1.1000008     20.49
    13/04/2009     382.56     12     1.1000008     31.88
    27/10/2010     1171.549344     12     1.1000009     97.63 -- THIS!
    13/10/2010     1171.549344     12     1.1000009     97.63
    06/09/2010     1171.549344     12     1.1000009     97.63
    02/08/2010     1048.825056     12     1.1000009     87.4
    28/07/2010     754.8     12     1.1000009     62.9
    27/07/2010     614.04     12     1.1000009     51.17
    21/06/2010     954.84     12     1.1000009     79.57
    27/05/2010     614.04     12     1.1000009     51.17
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26             --THIS!
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84
    07/07/2009     1143.17     12     1.1000010     95.26
    28/03/2009     1143.17     12     1.1000010     95.26
    27/10/2008     1744.644672     12     1.1000010     145.39
    01/07/2008     1690.12224     12     1.1000010     140.84

  • Problem query of XMLType column in XSQL servlet

    Hi all,
    I'm having trouble debugging the following error from a query on an XMLType column in an XSQL page query:
    <page xmlns:xsql="urn:oracle-xsql" connection="jdbc/DBConnection1DS">
    <xsql:query max-rows="1" null-indicator="no">
    SELECT extractValue(x.DOCBOOKS_DOC, '/book/part/title', 'xmlns="http://docbook.org/ns/docbook"') "BOOK TITLE"
    FROM DOCBOOKS_STORE x
    </xsql:query>
    </page>
    which returns the following error message:
    <page>
    <ERROR>
    oracle.xml.sql.OracleXMLSQLException: Character ' ' is not allowed in an XML tag name.
    </ERROR>
    </page>
    The SQL query works fine in the SQL Worksheet and SQL Plus, only when I stick it in an XSQL query. I've tested the XSQL Page environment with a query on Number Datatype column and no issues there either.
    Any suggestions, much appreciated. Thanks.
    George

    The XML SQL Utility creates XML tags named after your column aliases.
    You have aliased the column to a name containing a space: "BOOK TITLE"
    This error is telling you that the implied XML element whose name matches this column alias, which would be <BOOK TITLE> is not a legal name for an XML element since it has a space in it.
    You'll need to pick a column alias with no space in the name. For example, "BOOK_TITLE" and then in your XSLT stylesheet (or whatever downstream formatting tool you may be using) remove the underscore from the name and replace it with a space.

  • XMLTABLE returns only first row

    I have follwoing XML inserted into the column named as TEXT in the table MASTERTB.
    *<?xml version="1.0" encoding="utf-8" ?>*
    *<Rowsets DateCreated="2010-11-30T11:12:10" EndDate="2010-06-05T16:52:23" StartDate="2010-06-05T16:52:23" Version="12.0.10 Build(18)">*
    *<Rowset>*
    *<Columns>*
    *<Column Description="Material Number" MaxRange="1" MinRange="0" Name="MATERIAL" SQLDataType="1" SourceColumn="MATERIAL"/>*
    *<Column Description="" MaxRange="1" MinRange="0" Name="TANK" SQLDataType="1" SourceColumn="TANK"/>*
    *</Columns>*
    *<Row>*
    *<MATERIAL>1000000144</MATERIAL>*
    *<TANK>T1000</TANK>*
    *</Row>*
    *<Row>*
    *<MATERIAL>2000000008</MATERIAL>*
    *<TANK>T1000</TANK>*
    *</Row>*
    *<Row>*
    *<MATERIAL>2000000009</MATERIAL>*
    *<TANK>T1000</TANK>*
    *</Row>*
    *<Row>*
    *<MATERIAL>2000000016</MATERIAL>*
    *<TANK>T1000</TANK>*
    *</Row>*
    *<Row>*
    *<MATERIAL>3000000036</MATERIAL>*
    *<TANK>T1000</TANK>*
    *</Row>*
    *</Rowset>*
    *</Rowsets>*
    Now, when my requirement is to get all the Material values so when I run follwoing query in Oracle,
    SELECT RW.MATERIAL
    FROM MASTERTB TM,
    XMLTable('//Row' PASSING TM.TEXT
    COLUMNS  "MATERIAL"    CHAR(30) PATH 'MATERIAL') AS RW
    it return only 1000000144 (First MATERIAL). How can I read all the MATERIAL? Also, how can I read the entire XML in Text format if I want to check what has been inserted?
    ANy help will be appreciated !
    Edited by: 967327 on Oct 27, 2012 12:28 AM

    >
    <Rowsets DateCreated="2010-11-30T11:12:10" EndDate="2010-06-05T16:52:23" StartDate="2010-06-05T16:52:23" Version="12.0.10 Build(18)">
    <Rowset>
    </Rowset>
    >
    so where is </Rowsets> ?
    your query works for me
    SQL> select * from v$version where rownum=1;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    SQL>
    SQL> with MASTERTB as
      2  (select
      3  xmltype('<?xml version="1.0" encoding="utf-8" ?>
      4  <Rowsets DateCreated="2010-11-30T11:12:10" EndDate="2010-06-05T16:52:23" StartDate="2010-06-05T16:52:23" Version="12.0.10 Build(18)">
      5  <Rowset>
      6  <Columns>
      7  <Column Description="Material Number" MaxRange="1" MinRange="0" Name="MATERIAL" SQLDataType="1" SourceColumn="MATERIAL"/>
      8  <Column Description="" MaxRange="1" MinRange="0" Name="TANK" SQLDataType="1" SourceColumn="TANK"/>
      9  </Columns>
    10  <Row>
    11  <MATERIAL>1000000144</MATERIAL>
    12  <TANK>T1000</TANK>
    13  </Row>
    14  <Row>
    15  <MATERIAL>2000000008</MATERIAL>
    16  <TANK>T1000</TANK>
    17  </Row>
    18  <Row>
    19  <MATERIAL>2000000009</MATERIAL>
    20  <TANK>T1000</TANK>
    21  </Row>
    22  <Row>
    23  <MATERIAL>2000000016</MATERIAL>
    24  <TANK>T1000</TANK>
    25  </Row>
    26  <Row>
    27  <MATERIAL>3000000036</MATERIAL>
    28  <TANK>T1000</TANK>
    29  </Row>
    30  </Rowset></Rowsets>') TEXT from dual)
    31  SELECT RW.MATERIAL
    32  FROM MASTERTB TM,
    33  XMLTable('//Row' PASSING TM.TEXT
    34  COLUMNS "MATERIAL" CHAR(30) PATH 'MATERIAL') AS RW
    35  /
    MATERIAL
    1000000144
    2000000008
    2000000009
    2000000016
    3000000036
    SQL>
    SQL> select * from v$version where rownum=1;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SQL>
    SQL> with MASTERTB as
      2  (select
      3  xmltype('<?xml version="1.0" encoding="utf-8" ?>
      4  <Rowsets DateCreated="2010-11-30T11:12:10" EndDate="2010-06-05T16:52:23" StartDate="2010-06-05T16:52:23" Version="12.0.10 Build(18)">
      5  <Rowset>
      6  <Columns>
      7  <Column Description="Material Number" MaxRange="1" MinRange="0" Name="MATERIAL" SQLDataType="1" SourceColumn="MATERIAL"/>
      8  <Column Description="" MaxRange="1" MinRange="0" Name="TANK" SQLDataType="1" SourceColumn="TANK"/>
      9  </Columns>
    10  <Row>
    11  <MATERIAL>1000000144</MATERIAL>
    12  <TANK>T1000</TANK>
    13  </Row>
    14  <Row>
    15  <MATERIAL>2000000008</MATERIAL>
    16  <TANK>T1000</TANK>
    17  </Row>
    18  <Row>
    19  <MATERIAL>2000000009</MATERIAL>
    20  <TANK>T1000</TANK>
    21  </Row>
    22  <Row>
    23  <MATERIAL>2000000016</MATERIAL>
    24  <TANK>T1000</TANK>
    25  </Row>
    26  <Row>
    27  <MATERIAL>3000000036</MATERIAL>
    28  <TANK>T1000</TANK>
    29  </Row>
    30  </Rowset></Rowsets>') TEXT from dual)
    31  SELECT RW.MATERIAL
    32  FROM MASTERTB TM,
    33  XMLTable('//Row' PASSING TM.TEXT
    34  COLUMNS "MATERIAL" CHAR(30) PATH 'MATERIAL') AS RW
    35  /
    MATERIAL
    1000000144
    2000000008
    2000000009
    2000000016
    3000000036
    SQL> try
    31  SELECT RW.MATERIAL
    32  FROM MASTERTB TM,
    33  XMLTable('Rowsets/Rowset/Row' PASSING TM.TEXT
    34  COLUMNS "MATERIAL" varchar2(30) PATH 'MATERIAL') AS RW
    35  /
    MATERIAL
    1000000144
    2000000008
    2000000009
    2000000016
    3000000036
    SQL>

  • How to return only 1 row of data

    Hi,
    My problem if the table looks similar to the 1 below.
    ID pay_cycle pymnt_dt
    1 PAY 12/01/2006
    1 EX 12/05/2006
    2 PAY 12/08/2006
    If the ID (such as ID 1) has a pay cycle of EX, I only want to get its payment date. I don't want it to return any other rows. However if the ID has no pay_cycle of EX (such as ID 2) I want it to return the pymnt_dt of PAY. Is this possible through SQL? I am planning to place the SQL on a table view.

    Hi,
    I tried to join the query to other tables but I am getting an invalid column name error
    SELECT
    C.OPRID ,
    A.SHEET_ID ,
    A.SHEET_NAME ,
    B.NAME ,
    A.EMPLID ,
    A.SHEET_STATUS ,
    A.CREATION_DT ,
    A.APPROVAL_DT ,
    z.PYMNT_DT
    FROM
    PS_EX_SHEET_HDR A ,
    PS_PERSONAL_DATA B ,
    PSOPRDEFN C ,
    PS_EX_SHEET_APRVL D ,
    ( SELECT DISTINCT sheet_id,
    pymnt_dt FROM ( SELECT sheet_id,
    pay_cycle,
    pymnt_dt,
    seq_nbr,
    line_nbr,
    row_number() OVER (PARTITION BY sheet_id ORDER BY pay_cycle DESC) rn FROM ps_ex_sheet_pymnt )
    WHERE
    rn = 1) z WHERE A.SHEET_STATUS='PD' AND
    A.POST_STATUS_EX IN ('P','N') AND
    A.APPROVAL_LEVEL IN ('S','T','B','I') AND
    D.SHEET_ID = A.SHEET_ID AND
    D.APPROVER_TYPE = 'T' AND
    D.APPROVAL_STATUS NOT IN ('A', 'D') AND
    B.EMPLID = A.EMPLID AND
    A.SHEET_ID = z.SHEET_ID AND
    z.SEQ_NBR = ( SELECT MAX(SEQ_NBR) FROM PS_EX_SHEET_PYMNT X , PS_EX_SHEET_LINE T WHERE E.SHEET_ID = X.SHEET_ID AND
    X.SHEET_ID = T.SHEET_ID AND
    X.LINE_NBR = T.LINE_NBR) AND
    z.EMPLID = A.EMPLID AND
    A.EMPLID NOT IN ( SELECT X.EMPLID FROM PSOPRDEFN X WHERE X.OPRID = C.OPRID) ;

  • One to many to return only one row

    hi guys,
    i have an urgent problem here. i have a sql statement like below;
    SELECT ALM_SWAP2_REP.M_TP_RTMFRP0, ALM_SWAP2_REP.M_TP_RTMFRP1,
    ALM_SWAP2_REP.M_TP_RTMFRF0, ALM_SWAP2_REP.M_TP_RTMFRF1,
    To_Char(TRN_HDR_DBF.M_OPT_FLWFST,'YYYYMMDD') AS VALDATE, ALM_SWAP2_REP.M_TP_RTFXC02,
    ALM_SWAP2_REP.M_TP_RTFXC12, TRN_HDR_DBF.M_BRW_NOMU1, TRN_HDR_DBF.M_BRW_NOMU2,
    ALM_SWAP2_REP.M_TP_RTAMC02, ALM_SWAP2_REP.M_TP_RTAMC12,
    (CASE WHEN PAY_FLOW_DBF.M_LEG = 0 AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') THEN To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') END) AS RCV_DATE,
    (CASE WHEN PAY_FLOW_DBF.M_LEG = 1 AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') THEN To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD') END) AS PAY_DATE
    FROM ALM_SWAP2_REP, TRN_HDR_DBF, PAY_FLOW_DBF WHERE ALM_SWAP2_REP.M_REF_DATA = 456576
    AND ALM_SWAP2_REP.M_NB = TRN_HDR_DBF.M_NB
    AND ALM_SWAP2_REP.M_NB = PAY_FLOW_DBF.M_TRN_ID
    AND ALM_SWAP2_REP.M_NB = 228128
    AND '20100831' BETWEEN To_Char(PAY_FLOW_DBF.M_CALC_DATE0,'YYYYMMDD') AND To_Char(PAY_FLOW_DBF.M_CALC_DATE1,'YYYYMMDD')
    ORDER BY ALM_SWAP2_REP.M_TRN_GRP, ALM_SWAP2_REP.M_NB
    When I join few tables, the results are returned in two rows because I have two records that in table PAY_FLOW_DBF that matches one row in table ALM_SWAP2_REP. I need these two matches but I want it to be returned in only one row without using group by. Pls help me. Thankls

    user9274041 wrote:
    i have an urgent problem here.http://www.oracle.com/html/terms.html
    >
    4. Use of Community Services
    Community Services are provided as a convenience to users and Oracle is not obligated to provide any technical support for, or participate in, Community Services. While Community Services may include information regarding Oracle products and services, including information from Oracle employees, they are not an official customer support channel for Oracle.
    You may use Community Services subject to the following: (a) Community Services may be used solely for your personal, informational, noncommercial purposes; (b) Content provided on or through Community Services may not be redistributed; and (c) personal data about other users may not be stored or collected except where expressly authorized by Oracle
    >
    Could you explain how something that is for your personal, informational, noncommercial purposes can be urgent?
    Or is this a violation of the terms of use and abuse of these forums?

  • How can I modify this script to return only certain rows of my mySQL table?

    Hi there,
    I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
    My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
    I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
    I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
    $subscriberID = $_POST['subscriberID'];
    Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
    Any help is appreciated.
    <?php
    require_once(dirname(__FILE__) . "/2257safeDBconn.php");
    require_once(dirname(__FILE__) . "/functions.inc.php");
    require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
    * This is the main PHP file that process the HTTP parameters,
    * performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
    * and then serialize the response in an XML format.
    * XmlSerializer uses a PEAR xml parser to generate an xml response.
    * this takes a php array and generates an xml according to the following rules:
    * - the root tag name is called "response"
    * - if the current value is a hash, generate a tagname with the key value, recurse inside
    * - if the current value is an array, generated tags with the default value "row"
    * for example, we have the following array:
    * $arr = array(
    *      "data" => array(
    *           array("id_pol" => 1, "name_pol" => "name 1"),
    *           array("id_pol" => 2, "name_pol" => "name 2")
    *      "metadata" => array(
    *           "pageNum" => 1,
    *           "totalRows" => 345
    * we will get an xml of the following form
    * <?xml version="1.0" encoding="ISO-8859-1"?>
    * <response>
    *   <data>
    *     <row>
    *       <id_pol>1</id_pol>
    *       <name_pol>name 1</name_pol>
    *     </row>
    *     <row>
    *       <id_pol>2</id_pol>
    *       <name_pol>name 2</name_pol>
    *     </row>
    *   </data>
    *   <metadata>
    *     <totalRows>345</totalRows>
    *     <pageNum>1</pageNum>
    *   </metadata>
    * </response>
    * Please notice that the generated server side code does not have any
    * specific authentication mechanism in place.
    * The filter field. This is the only field that we will do filtering after.
    $filter_field = "subscriber_id";
    * we need to escape the value, so we need to know what it is
    * possible values: text, long, int, double, date, defined
    $filter_type = "text";
    * constructs and executes a sql select query against the selected database
    * can take the following parameters:
    * $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
    * $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
    * $_REQUEST["filter"] - the filter value
    * $_REQUEST["pageNum"] - the page index
    * $_REQUEST["pageSize"] - the page size (number of rows to return)
    * if neither pageNum and pageSize appear, we do a full select, no limit
    * returns : an array of the form
    * array (
    *           data => array(
    *                array('field1' => "value1", "field2" => "value2")
    *           metadata => array(
    *                "pageNum" => page_index,
    *                "totalRows" => number_of_rows
    function findAll() {
         global $conn, $filter_field, $filter_type;
          * the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
         $fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         $order = "";
         if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
              $order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //get the page number, and the page size
         $pageNum = (int)@$_REQUEST["pageNum"];
         $pageSize = (int)@$_REQUEST["pageSize"];
         //calculate the start row for the limit clause
         $start = $pageNum * $pageSize;
         //construct the query, using the where and order condition
         $query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
         //if we use pagination, add the limit clause
         if ($pageNum >= 0 && $pageSize > 0) {     
              $query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
         $recordset = mysql_query($query_recordset, $conn);
         //if we have rows in the table, loop through them and fill the array
         $toret = array();
         while ($row_recordset = mysql_fetch_assoc($recordset)) {
              array_push($toret, $row_recordset);
         //create the standard response structure
         $toret = array(
              "data" => $toret,
              "metadata" => array (
                   "totalRows" => $totalrows,
                   "pageNum" => $pageNum
         return $toret;
    * constructs and executes a sql count query against the selected database
    * can take the following parameters:
    * $_REQUEST["filter"] - the filter value
    * returns : an array of the form
    * array (
    *           data => number_of_rows,
    *           metadata => array()
    function rowCount() {
         global $conn, $filter_field, $filter_type;
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //create the standard response structure
         $toret = array(
              "data" => $totalrows,
              "metadata" => array()
         return $toret;

    Hi there,
    I have a php script that accesses a mySQL database and it was generated out of the Flex Builder wizard automatically. The script works great and there are no problems with it. It allows me to perform CRUD on a table by calling it from my Flex app. and it retrieves all the data and puts it into a nice MXML format.
    My question, currently when I call "findAll" to retrieve all the data in the table, well, it retrieves ALL the rows in the table. That's fine, but my table is starting to grow really large with thousands of rows.
    I want to modify this script so that I can pass a variable into it from Flex so that it only retrieves the rows that match the "$subscriber_id" variable that I pass. In this way the results are not the entire table's data, only the rows that match 'subscriber_id'.
    I know how to pass a variable from Flex into php and the code on the php side to pick it up would look like this:
    $subscriberID = $_POST['subscriberID'];
    Can anyone shed light as to the proper code modification in "findAll" which will take my $subscriberID variable and compare it to the 'subscriber_id' field and then only return those rows that match? I think it has something to do with lines 98 to 101.
    Any help is appreciated.
    <?php
    require_once(dirname(__FILE__) . "/2257safeDBconn.php");
    require_once(dirname(__FILE__) . "/functions.inc.php");
    require_once(dirname(__FILE__) . "/XmlSerializer.class.php");
    * This is the main PHP file that process the HTTP parameters,
    * performs the basic db operations (FIND, INSERT, UPDATE, DELETE)
    * and then serialize the response in an XML format.
    * XmlSerializer uses a PEAR xml parser to generate an xml response.
    * this takes a php array and generates an xml according to the following rules:
    * - the root tag name is called "response"
    * - if the current value is a hash, generate a tagname with the key value, recurse inside
    * - if the current value is an array, generated tags with the default value "row"
    * for example, we have the following array:
    * $arr = array(
    *      "data" => array(
    *           array("id_pol" => 1, "name_pol" => "name 1"),
    *           array("id_pol" => 2, "name_pol" => "name 2")
    *      "metadata" => array(
    *           "pageNum" => 1,
    *           "totalRows" => 345
    * we will get an xml of the following form
    * <?xml version="1.0" encoding="ISO-8859-1"?>
    * <response>
    *   <data>
    *     <row>
    *       <id_pol>1</id_pol>
    *       <name_pol>name 1</name_pol>
    *     </row>
    *     <row>
    *       <id_pol>2</id_pol>
    *       <name_pol>name 2</name_pol>
    *     </row>
    *   </data>
    *   <metadata>
    *     <totalRows>345</totalRows>
    *     <pageNum>1</pageNum>
    *   </metadata>
    * </response>
    * Please notice that the generated server side code does not have any
    * specific authentication mechanism in place.
    * The filter field. This is the only field that we will do filtering after.
    $filter_field = "subscriber_id";
    * we need to escape the value, so we need to know what it is
    * possible values: text, long, int, double, date, defined
    $filter_type = "text";
    * constructs and executes a sql select query against the selected database
    * can take the following parameters:
    * $_REQUEST["orderField"] - the field by which we do the ordering. MUST appear inside $fields.
    * $_REQUEST["orderValue"] - ASC or DESC. If neither, the default value is ASC
    * $_REQUEST["filter"] - the filter value
    * $_REQUEST["pageNum"] - the page index
    * $_REQUEST["pageSize"] - the page size (number of rows to return)
    * if neither pageNum and pageSize appear, we do a full select, no limit
    * returns : an array of the form
    * array (
    *           data => array(
    *                array('field1' => "value1", "field2" => "value2")
    *           metadata => array(
    *                "pageNum" => page_index,
    *                "totalRows" => number_of_rows
    function findAll() {
         global $conn, $filter_field, $filter_type;
          * the list of fields in the table. We need this to check that the sent value for the ordering is indeed correct.
         $fields = array('id','subscriber_id','lastName','firstName','birthdate','gender');
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         $order = "";
         if (@$_REQUEST["orderField"] != "" && in_array(@$_REQUEST["orderField"], $fields)) {
              $order = "ORDER BY " . @$_REQUEST["orderField"] . " " . (in_array(@$_REQUEST["orderDirection"], array("ASC", "DESC")) ? @$_REQUEST["orderDirection"] : "ASC");
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //get the page number, and the page size
         $pageNum = (int)@$_REQUEST["pageNum"];
         $pageSize = (int)@$_REQUEST["pageSize"];
         //calculate the start row for the limit clause
         $start = $pageNum * $pageSize;
         //construct the query, using the where and order condition
         $query_recordset = "SELECT id,subscriber_id,lastName,firstName,birthdate,gender FROM `modelName` $where $order";
         //if we use pagination, add the limit clause
         if ($pageNum >= 0 && $pageSize > 0) {     
              $query_recordset = sprintf("%s LIMIT %d, %d", $query_recordset, $start, $pageSize);
         $recordset = mysql_query($query_recordset, $conn);
         //if we have rows in the table, loop through them and fill the array
         $toret = array();
         while ($row_recordset = mysql_fetch_assoc($recordset)) {
              array_push($toret, $row_recordset);
         //create the standard response structure
         $toret = array(
              "data" => $toret,
              "metadata" => array (
                   "totalRows" => $totalrows,
                   "pageNum" => $pageNum
         return $toret;
    * constructs and executes a sql count query against the selected database
    * can take the following parameters:
    * $_REQUEST["filter"] - the filter value
    * returns : an array of the form
    * array (
    *           data => number_of_rows,
    *           metadata => array()
    function rowCount() {
         global $conn, $filter_field, $filter_type;
         $where = "";
         if (@$_REQUEST['filter'] != "") {
              $where = "WHERE " . $filter_field . " LIKE " . GetSQLValueStringForSelect(@$_REQUEST["filter"], $filter_type);     
         //calculate the number of rows in this table
         $rscount = mysql_query("SELECT count(*) AS cnt FROM `modelName` $where");
         $row_rscount = mysql_fetch_assoc($rscount);
         $totalrows = (int) $row_rscount["cnt"];
         //create the standard response structure
         $toret = array(
              "data" => $totalrows,
              "metadata" => array()
         return $toret;

  • Applying table scroll bar for only table rows with table columns fixed.

    hi oa gurus,
    i had implemented table scroll bars using oarawtextbean , there is no problem in vertical and horizontal scroll bar working its working fine. but the requirement is i need to scroll only the table rows with table columns fixed. so , how to achieve the table scroll for only table datas neglecting table headers.
    the code for vertical and horizontal bars scroll is like this,
    OARawTextBean ors = (OARawTextBean)webBean.findChildRecursive("raw1");
    ors.setText(div id=tabledivid style=height:500px;width:100%; overflow:auto>);
    OARawTextBean ore = (OARawTextBean)webBean.findChildRecursive("raw2");
    ore.setText("</div>");
    where raw1 and raw2 are rawtextbean created above and below of the table . but i dont know hoow to apply this only for table rows neglecting table columns , can anybody give any ideas.
    pelase this is very urgent , can u help me in this regards
    thanks
    Edited by: user630121 on Sep 29, 2008 5:17 AM
    Edited by: user630121 on Sep 29, 2008 5:18 AM

    hi,
    I have a similar task to do... Only to apply scrollbar at the table level.
    I tried using the above mentioned but I am facing Null Pointer Exception..
    Please explain about raw1 and raw2
    Rahul

  • Select from Oracle to MySQL returns only one row

    Environment:
    The Oracle Developer Days Virtual Box image, so that's 11gR2 EE on OEL
    MySQL 5.1.51-community
    mysql-connector-odbc-5.1.7-0.i386.rpm
    unixODBC 2.3.0
    I got the connection working, I can insert, update and delete records in the MySQL DB from Oracle (SQL Plus).
    But when I enter select * from "employees"@mysql I only get the first record returned.
    If I enter select * from "employees"@mysql order by "id" desc, I only get the last one...
    If I enter select count(*) from "employees"@mysql, I get the - correct - result of 3.
    So, how do I get the complete set of (all) records from a MySQL table in Oracle? Is there some kind of setting or is this intended behavior and do I have to create a PL/SQL loop and put the results into a collection or something like that?

    I've create a table like yours:
    create table gateway.employees(id int(10) auto_increment,
    first_name varchar(30),
    last_name varchar(100),
    personal_code varchar(20),
    birthday date,
    salary decimal(10,2),
    is_active int(1),
    PRIMARY KEY (id));
    insert into gateway.employees (first_name,last_name) values ('Name 1', 'Name 1');
    insert into gateway.employees (first_name,last_name) values ('Name 2', 'Name 2');
    insert into gateway.employees (first_name,last_name) values ('Name 3', 'Name 3');
    insert into gateway.employees (first_name,last_name) values ('Name 4', 'Name 4');
    insert into gateway.employees (first_name,last_name) values ('Name 5', 'Name 5');
    select * from gateway.employees;
    and tested it using DataDirect and MySQL ODBC.
    The DataDirect shows all 5 lines whereas MySQL 5.1.0.7 ODBC shows only 1 row.
    (isql isn't using extended fetching like DG4ODBC does).
    Edited by: kgronau on Nov 4, 2010 4:03 PM
    Here the result (fetching ID column):
    MySQl ODBC;
    SQL> select "id" from "employees"@MYSQL_EMGTW_1121_DB;
    id
    1
    DD ODBC V6:
    SQL> select "id" from "employees"@DD60_MYSQL_EMGTW_1121_DB;
    id
    1
    2
    3
    4
    5
    Edited by: kgronau on Nov 4, 2010 4:33 PM
    The 32bit version of MySQL ODBC (5.1.5 - no 5.1.7 release yet installed) works also:
    SQL> select "id" from "employees"@MYSQL_32;
    id
    1
    2
    3
    4
    5
    => so it is an ODBC issue

  • Return to selected row with refresh after update in edit  form

    Hi,
    I created a database view.When selected a single row and click on button i can edit the row in a form for update.What i want, when doing some update and click on the commit button i return back on the initial row with a refresh to see the update done on this row.I succeeded to modify the form and commit.But when i return on the selected row my update is not visible.How can i return to the same selected row with a refresh.In oracle form i can do a go record with execute_query, but how to do this in ADF.Please someone can help so that i do not spend many days on it.
    Thanks
    Soodesh

    [click for the tutorial|http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=6&ved=0CFQQFjAF&url=http%3A%2F%2Fandrejusb.blogspot.com%2F2013%2F03%2Fadf-rollback-and-keep-current-row.html&ei=Tnl3Ucn3BoXIrQeemICQAw&usg=AFQjCNHdYcJL8kJKymqbWBT9XDGTWmeUvQ&bvm=bv.45580626,d.bmk&cad=rja]
    here you go :)

  • SQL subquery returning too many rows with Max function

    Hello, I hope someone can help me, I been working on this all day. I need to get max value, and the date and id where that max value is associated with between specific date ranges. Here is my code , and I have tried many different version but it still returning
    more than one ID and date
    Thanks in advance
    SELECT
      distinctbw_s.id, 
    avs.carProd,cd_s.RecordDate,
    cd_s.milkProductionasMilkProd,
    cd_s.WaterProductionasWaterProd
    FROMtblTestbw_s
    INNERJOINtblTestCpcd_sWITH(NOLOCK)
    ONbw_s.id=cd_s.id   
    ANDcd_s.recorddateBETWEEN'08/06/2014'AND'10/05/2014'
    InnerJoin
    (selectid,max(CarVol)ascarProd
    fromtblTestCp
    whererecorddateBETWEEN'08/06/2014'AND'10/05/2014'
     groupby 
    id)avs
    onavs.id=bw_s.id
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155   0 225
    47790 2014-10-01   13444    0 0
    47790 2014-08-06   132111    10 100
    47790 2014-09-05   10000    500 145
    47790 2014-09-20   10000    800 500
    47791 2014-09-20   10000    300 500
    47791 2014-09-21   10001    400 500
    47791 2014-08-21   20001    600 500
    And the result should be ( max carprod)
    id RecordDate carProd       MilkProd WaterProd
    47790 2014-10-05   132155  0 225
    47791 2014-08-21   20001    600 500

    Help your readers help you.  Remember that we cannot see your screen, do not know your data, do not understand your schema, and cannot test a query without a complete script.  So - remove the derived table (to which you gave the alias "avs")
    and the associated columns from your query.  Does that generate the correct results?  I have my doubts since you say "too many" and the derived table will generate a single row per ID.  That suggests that your join between the first
    2 tables is the source of the problem.  In addition, the use of DISTINCT is generally a sign that the query logic is incorrect, that there is a schema issue, or that there is a misunderstanding of the schema. 

  • Convert column values into a row with a delimiter

    Hi Gurus,
    This may be a trivial question to you. I have an internal table itab with a column called plant, internal table has 'n' records, by the end of loop, I need to convert the column into a row delimited by comma into one row (one field). This needs to be dynamic without hard-coding.
    Plant
    1000
    2000
    3000
    4000
    5000 ....
    n....
    Expected result of the field:
    field1 value: 1000,2000,3000,4000,5000,...n
    Let's set a limit to the field say it can hold upto 500 chars.
    Thanks,
    GP.

    Hi,
    I've already tried this:
      ELSEIF <fs_dms_cv>-zca_cv_attr_ind = c_multiple.
      w_plant = <fs_plant_ele>-werks.
      concatenate w_string w_plant
                    into w_string separated by c_delimiter.
          IF w_end_fl = c_on.
          w_tabname = <fs_dms_cv>-dbtabname.
           ASSIGN (w_tabname) TO <fs_tabname>.
            IF sy-subrc = 0.
             ASSIGN COMPONENT <fs_dms_cv>-name_komp OF 
                STRUCTURE <fs_tabname> TO <fs_destination>.
                        IF sy-subrc = 0.
                          <fs_destination> = w_string.
                        ENDIF.
            ENDIF.
    There are 2 issues here: One is that after first plant there will be two commas inserted, after that it's consistent. Secondly the key word concatenate is against our code standards.
    Please let me know if there is any other way of doing this.
    Thanks.

Maybe you are looking for