Capture when finished iterating over query results...

Hello. I have a flex app that queries a web service. The code
to iterate over the results is shown below. the query string is
passed to the connection, and the results are processed inline.
I want to know when i'm done iterating over the results. How
do i do this? My current approach seems clumsy. I add an event
listener to my connection for query complete. When that fires, I
get the length of the result set. Then in my iterator, i have a
condition that checks when the record count is equal to the length
of the result set. i assume there's an easier/better way?
queryResultIterator2 = new QueryResultIterator(wsconn,
queryString,
function (so:SObject):Boolean {
productCodeAC.addItem(so.Product_Code__c);
return true;
thanks
chris

Hi Dan
When i use the cfouput with the group attribute... the query only returns one of the columns from the table for stock spool sizes...
so the new query results will have 1 part which is good 10 Sol | 31.43 | 1000
but only 1000 .. when it should return 1000 | 2500 | 5000  based on that wireid
Thanks

Similar Messages

  • 2.1EA2: Pinning Query Results and changing Connections [fixed in 2.1.0]

    I am on 2.1EA2 (JDK 1.6.0_16) and been playing with the new SQL Worksheet pin query results functionality. I have found that it is possible to run a query against one connection, pin the results and then change connection and run the same (or a different) query against another connection. I really like this, but found a few problems:
    #1 There doesn't seem to be any way to tell which connection a query result tab was actually run against
    #2 Even if all rows are fetched, if I then disconnect from the first connection it can get quite messy. Sometimes I get an empty connection dialog (I can't remember the exact title and it doesn't reproduce consistently) with only the close window X in the corner. Some times I get prompted to log in with a connection information dialog with no reference to the connection it is connecting to - cancelling only brings up the same dialog again until I successfully connect. Some times I get prompted to log in and while that is still on the screen, SQL Developer logs me back in to the connection (even though I don't save passwords) - I even get a new worksheet for the reconnected connection.
    theFurryOne

    Raghu,
    I am happy with both.
    #1 - I would be happy if the connection name was at the start of the tool-tip style pop-up when hovering over Query Results tab and the Query Result SQL dialog that opens on the SQL button. -K-'s suggestion makes it immediately obvious for the currently selected Query Results tab, without having to move the mouse or click on something.
    Ideally, I would like something similar for the other output tabs (ie Script Output), but they seem to show results for all connections that the worksheet has used, so the same concept may not work.
    #2 - I am used to the grid being cleared when disconnecting from earlier versions - I assumed that this was a bug where SQLD was not checking the connection of the results, just the current connection of the worksheet.
    theFurryOne

  • Bug SQL Dev 1.5.4 Build MAIN-5940 Exporting count(*) query results

    when trying to export query results containing an analytic count the export dialog fails to open:
    When running the following query
    select count(*) over (partition by dummy order by rownum) xx
      from dual;right clicking on the results grid and selecting export->xls (or any other format) fails to open the export dialog box.
    changing the asterisk (*) to another value e.g. 1 or dummy corrects this issue for this particular query as does changing the analytic fuction to an aggregate function.
    Edited by: Sentinel on Aug 12, 2009 11:05 AM

    I get the same error when exporting the same statement - however, there is a known problem with 1.5.4 and failing on exports of certain statements (see 1.5.3 - Export results to XLS ORA-00936 which talks about there still being problems in 1.5.4 although the thread is titled 1.5.3).
    theFurryOne

  • Query results display help

    Hello
    I'm having a issue with displaying the results of my query output.
    When I cfloop over the results.. the part number is being output on 3 different rows... when I want it on one row querying multiple tables.. and you cant use the group option with the cfloop
    here is the query
    <cfquery datasource="wire" name="testss3">
       SELECT a.part AS pparts, a.wireid AS wireidA, a.strnds, a.wt, a.sps1, a.sps2, a.sps3, a.tin, b.slookup AS lid, b.wireid AS wireidB, b.reelid AS reelnmbr, d.reelid AS rlid, d.rname, d.rsku, d.rcost, e.plookupid, e.prctid, e.wireid AS wireidE, f.prctid, f.percentage, g.rsize
       FROM Mpart a, slookupt b, reeltbl d, prctlup e, prct f, spoolsize g
       WHERE a.wireid = b.wireid AND e.prctid = f.prctid AND a.wireid = e.wireid AND b.reelid = d.reelid AND g.spoolSizeid = b.spoolSizeid
       </cfquery>
    <table border="1" border="1">
    <tr>
            <td></td>
            <td bgcolor="#CCCCCC" class="style23">Part No.  </td>
            <td bgcolor="#CCCCCC" class="style23">Wt./Mft.</td>
            <td bgcolor="#CCCCCC" class="style23" colspan="3">Spool Sizes (Cost/ft.)</td>
            <td> </td>
          </tr>
       <cfloop query="testss3"><cfoutput>
         <tr>
            <td></td>
               <td align="left" class="style23">#pparts# @</td>
                <td align="left" class="style23">#wt#</td>
               <td align="left" class="style23">
                #rsize# #rcost#  #wireidA#</cfoutput></cfloop></td>
            <td> </td>
           </tr>      
    </table>
    Part No. 
    Wt./Mft.
    Stock Spool Sizes (Cost/ft.)
    10 sol @
    31.43
    1000 2.8000 1 
    10 sol @
    31.43
    2500 5.9800 1 
    10 sol @
    31.43
    5000 7.3000 1 
    10T @
    31.43
    1000 2.8000 2 
    10T @
    31.43
    2500 5.9800 2 
    10T @
    31.43
    5000 7.3000 2 
    8 sol @
    50
    500 2.8000 4 
    8 sol @
    50
    1000 5.9800 4 
    8 sol @
    50
    5000 7.3000 4 
    8T @
    50
    500 2.8000 5 
    8T @
    50
    1000 5.9800 5 
    8T @
    50
    5000 7.3000 5
    the first row should read 10 sol | 31.43 | 1000 | 2500 | 5000
    the next row 10T | 31.43 | 1000 | 2500 | 5000
    Any help would be much appreciated!
    Thanks!

    Hi Dan
    When i use the cfouput with the group attribute... the query only returns one of the columns from the table for stock spool sizes...
    so the new query results will have 1 part which is good 10 Sol | 31.43 | 1000
    but only 1000 .. when it should return 1000 | 2500 | 5000  based on that wireid
    Thanks

  • Query results returns document when getDocuments does not

    When we run an xquery, we get results that we can't be found in the getDocuments results.
    We run an xquery to get a key to an xml document.
    Then we attempt to retrieve that document and get a DOCUMENT_NOT_FOUND error.
    I can run the same xquery in dbxml and variations of that xquery and see the xml I expect to.
    getDocuments <keyvalue> does not work.
    Additionally, I run "getDocuments docs.txt"
    and search docs.txt for the xml I saw in the query results, and no luck.
    The document I'm looking for does not show up in the getDocumentNames names.txt
    either.
    I'm still using BDB XML 2.2.13 no patches on Solaris and W2k3.
    We can easily get the database into a state like this by running lengthy queries, putting, getting, removing documents on a multi-thread, concurrent basis.
    What's going on here, is there a work around?
    Thanks in Advanced,
    Douglas Moore

    Douglas,
    Hopefully you can upgrade to 2.3.10 and get past this. If you are not using any 2.2.13 patches, that could be the problem -- this may be a patched issue in 2.2.13. It could also be a subtle bug in your application.
    Either way, once you get into this state, you should be able to get out of it by reindexing the container (XmlManager::reindexContainer() or using the dbxml shell). If you choose to reindex, be very sure that not other threads or processes are in the environment and that you are backed up. Reindexing will remove all index databases and walk the container, re-creating them.
    Regards,
    George

  • How can I view more than one result on the screen when I search for apps? eg I search for my hobby and there are over 1500 results - one result per screen - do I have to swipe 1500 times to see them all?

    I search for apps about my hobby. There are over 1500 results. Each single result takes up the whole screen. I will have to swipe the screen 1500 times to see all the results. How can I see 8 or 10 results and scroll through fast? Thanks very much for any suggestions!

    Bump:)
    But I've found some online reviews of this and I think we
    are stuck with this amazingly awful search system until
    they realize people like me won't bother searching for or buying
    Apps.
    Does a novel display one sentence per page?
    Do you listen to a radio documentary that transmits one word a minute?
    Or how about a song that is broken into four parts because the singers ran out of breath?
    Searching app products has never been easy or a pleasure, and now it's tougher than ever. Who has the time to swipe 1,600 times? It HURTS - and hurts my brain just thinking about it.
    Woe is me!
    Woe are we!

  • Two unexpected Locals variables when iterating over array of containers​.

    Hi,
    I iterate over an array of containers. In the ForEach loop step variables format I have defined two variables; one is current offset, second one is current element.
    The loop works fine.
    However, during the debug process, I've spotted two new Locals variables called __ElementSibling0 (type: number) and __ForEachReleaser0 (type: obj. reference) created silently by TS as soon as I start iterating over my array. What are they?
    Do they exist because:
    I'm iterating over an array of containers, or
    I use  the _currentElement_Freq variable, or
    it always like that?
    Solved!
    Go to Solution.

    Those are used by the implementation of the For Each step. You can see them only because you have enabled the Show Hidden Properties setting.
    You can safely ignore their presence.

  • MissingResourceException when I iterator a collection after closing the PM

    I retrieve a collection, call pm.retrieveAll on it, and then close the PM.
    When I try to iterator over the collection, I get a
    MissingResourceException. I can't figure out why I'm getting the exception,
    if I do a retrieveAll it should retrieve all the fields of all the objects
    in the collection. It's as if there is a rule "Thou shall not iterator over
    a collection after closing the PM". Is this true?
    java.util.MissingResourceException: Can't find resource for bundle
    java.util.PropertyResourceBundle, key resultlist-closed
    at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
    at java.util.ResourceBundle.getString(ResourceBundle.java:274)
    at serp.util.Localizer.get(Localizer.java:270)
    at serp.util.Localizer.get(Localizer.java:121)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.checkClosed(LazyResult
    List.java:349)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.listIterator(LazyResul
    tList.java:403)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.iterator(LazyResultLis
    t.java:397)
    at
    com.verideon.siteguard.services.SchedulerService.getMonitorsToRun(SchedulerS
    ervice.java:103)
    at
    com.verideon.siteguard.services.SchedulerService.schedule(SchedulerService.j
    ava:59)
    at
    com.verideon.siteguard.web.util.TimerServlet$scheduleTask.run(TimerServlet.j
    ava:84)
    at java.util.TimerThread.mainLoop(Timer.java:432)
    at java.util.TimerThread.run(Timer.java:382)
    Here is my code:
    private Collection getMonitorsToRun() {
    Collection c = new LinkedList();
    PersistenceManager pm = null;
    try {
    pm = JDOFactory.getPersistenceManager();
    Extent extent = pm.getExtent(Monitor.class, true);
    String filter = "nextDate <= now";
    Query q = pm.newQuery(extent, filter);
    q.declareParameters("java.util.Date now");
    q.setOrdering("nextDate ascending");
    Hashtable p = new Hashtable();
    p.put("now", new Date());
    c = (Collection) q.executeWithMap(p);
    pm.retrieveAll(c);
    } catch (JDOException e) {
    log.warn("Received JDO Exception while retrieving Monitors " + e);
    } finally {
    pm.close();
    log.debug("Retrieved " + c.size() + " Monitors ready to be ran.");
    Iterator i = c.iterator();
    while (i.hasNext()) {
    Monitor m = (Monitor) i.next();
    log.debug("m id = " + m.getId());
    return c;

    It appears to be a query in which case, yes, a Query result Collection cannot be iterated over.
    The simple way to bypass this is to transfer the results to a non-closing Collection.
    Collection results = (Collection) q.execute ();
    results = new LinkedList (results);
    pm.retrieveAll (results);
    pm.close ();
    On Thu, 27 Feb 2003 14:49:17 +0100, Michael Mattox wrote:
    I retrieve a collection, call pm.retrieveAll on it, and then close the PM.
    When I try to iterator over the collection, I get a
    MissingResourceException. I can't figure out why I'm getting the exception,
    if I do a retrieveAll it should retrieve all the fields of all the objects
    in the collection. It's as if there is a rule "Thou shall not iterator over
    a collection after closing the PM". Is this true?
    java.util.MissingResourceException: Can't find resource for bundle
    java.util.PropertyResourceBundle, key resultlist-closed
    at java.util.ResourceBundle.getObject(ResourceBundle.java:314)
    at java.util.ResourceBundle.getString(ResourceBundle.java:274)
    at serp.util.Localizer.get(Localizer.java:270)
    at serp.util.Localizer.get(Localizer.java:121)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.checkClosed(LazyResult
    List.java:349)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.listIterator(LazyResul
    tList.java:403)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.LazyResultList.iterator(LazyResultLis
    t.java:397)
    at
    com.verideon.siteguard.services.SchedulerService.getMonitorsToRun(SchedulerS
    ervice.java:103)
    at
    com.verideon.siteguard.services.SchedulerService.schedule(SchedulerService.j
    ava:59)
    at
    com.verideon.siteguard.web.util.TimerServlet$scheduleTask.run(TimerServlet.j
    ava:84)
    at java.util.TimerThread.mainLoop(Timer.java:432)
    at java.util.TimerThread.run(Timer.java:382)
    Here is my code:
    private Collection getMonitorsToRun() {
    Collection c = new LinkedList();
    PersistenceManager pm = null;
    try {
    pm = JDOFactory.getPersistenceManager();
    Extent extent = pm.getExtent(Monitor.class, true);
    String filter = "nextDate <= now";
    Query q = pm.newQuery(extent, filter);
    q.declareParameters("java.util.Date now");
    q.setOrdering("nextDate ascending");
    Hashtable p = new Hashtable();
    p.put("now", new Date());
    c = (Collection) q.executeWithMap(p);
    pm.retrieveAll(c);
    } catch (JDOException e) {
    log.warn("Received JDO Exception while retrieving Monitors " + e);
    } finally {
    pm.close();
    log.debug("Retrieved " + c.size() + " Monitors ready to be ran.");
    Iterator i = c.iterator();
    while (i.hasNext()) {
    Monitor m = (Monitor) i.next();
    log.debug("m id = " + m.getId());
    return c;
    Stephen Kim
    [email protected]
    SolarMetric, Inc.
    http://www.solarmetric.com

  • Extract SQL Query Results to 'xlsx' bogs down at 150,000 rows

    Environment:
    SQL*Developer 3.1.07.42 on Windows XP SP3
    Oracle 11.2.0.3 EE on Solaris 10.5
    I ran a query in a worksheet window and the first page of results came back in 10 seconds, whoo hooo!
    I right-clicked the first column in the first row and selected 'Count Rows' and it returned 527,563 after thinking a bit.
    I right-clicked 'Export', selected a format of 'xlsx', unchecked the box for 'Query Worksheet Name' and browsed to specify the output file directory (my local C: drive) and file name. I clicked 'Next' and then 'Finish'.
    I watch the row counter at the bottom right of the window and it went very fast until it hit about 150,000 rows and then it started slowing down. It got slower and slower and slower and slower, well you get the picture, and I finally killed the process when it took over 15 seconds to get from 156,245 to 156,250.
    Why would this be?
    Additional information:
    I ran the exact same query again and exported the same 527,563 rows using the 'xls' format instead of 'xlsx' and the process proceeded very quickly all the way to the end and completed successfully in just several minutes. The resultant spreadsheet contained eight (8) worksheets since it could only put 65536 rows into each worksheet. This was acceptable to the user who simply merged the data manually.
    Is there some issues with using 'xlsx' as the output format as opposed to just using it as an input format?
    Does SQL*Developer try to create a spreadsheet with as many rows as the data up to the max in Excel 2010 (which is more than 527,563)?
    Thanks very much for any light shed on this issue. If I've left out any important details please let me know and I'll try to include them.
    -gary

    Hi gary,
    You may have already seen one or more threads like the following on the issue of increased memory overhead for the Excel formats:
    Re: Sql Developer 3.1 - Exporting a result set in xls generates and empty file
    Basically SQL Developer uses a third-party API to read and write these Excel formats. There are distinct readers and formatters for each of the xls and xlsx forms.
    There is a newer version of the API that supports streaming of xlsx Workbooks. Basically it achieves a much lower footprint by keeping in memory only rows that are within a sliding window, while the older, non-streaming version gives access to all rows in the document. The programmer may define the size of this window. I believe the newer API version was either not available or not stable during our 3.1 development cycle. Possibly a future SQL Developer version might use it.
    Regards,
    Gary
    SQL Developer Team

  • 3.1EA1: Query results do not display

    The results of any query I run in 3.1EA1 do not show in the Query Result tab. When I run sqldeveloper.exe from the command prompt, there are no errors. Sqldeveloper 3.0 is fine.
    Oracle Database: 10.2.0.4.0
    Java version: 1.6.0_26
    Operation System: Windows XP Prod sp3

    Hi Raghu,
    Yes, you are correct. It seems to be related to SQLHistory. This is what I did.
    -- Deleted everything in the SQLHistory folder as suggested.
    -- Started SQLDeveloper and ran query from worksheet
    -- Got results fine, but then immediately got a dialog box saying Migrating SQL history.
    -- This produced an error
    source: o.d.worksheet.sqlhistory
    message: sun.nio.cs.StreamDecoder.forInputStreamReader (StreamDecoder.java:52)
    -- After it finished, sql history was filled again with all the files.
    -- Restarted SQLDeveloper and the problem was back.
    -- Discovered in the SQLDeveloper directory (at same level as the SQLHistory folder) another file called SQLHistory.xml (presumably from a previous version which was the one being migrated)
    -- Renamed the previous sqlhistory.xml file and the issue seems to have gone away since only my new SQL in the history folder now.
    However, I assume that over time, the problem will come back when history gets to a certain size ? I did have about 1200 entries in my folder before deleting.
    Will there be a fix for this, as I use sql history quite often ?
    Hope this helps track down the problem.
    Thanks,
    Mark

  • What is the order of Column Names in Sqlite query results?

    I am writing an application using Adobe Air, Sqlite, and Javascript.
    After writing the following select statement:
              SELECT field1, field 2, field 3, field 4 FROM TableA;
    I would like to get the columnName/data combination from each row -- which I do successfully with a loop:
              var columnName="";
              for (columnName in selResults.data[i]) {
                   output+=columnName + ":" + selResultsdata[i][columnName] + ";";
    My issue is that the column names come out in a different order every time I run the query and never once have they come out in the desired order -- field 1, field 2, field 3, field 4.  If I run the query in Firefox's Sqlite Manager, the columns come out in the "proper" order. When I run them in Adobe Air, the order will be the same if I run the query mulitple times without closing the app.  If I make a change such as declaring the columnName variable with "" before the for column, or declare it as (var = columnName in selResults.data) , then the order changes.  If I shut down my app and re-open after lunch and run query, it comes out in another order.  At this time, I'm not interested in the order of the rows, just the order of the columns in each output row.  I've even tried assiging an index to columnName which seems to just pick up a single letter of the columnName.
    I'm in the process of changing my HTML presentation of the data to assign a precise columnName to an HTML table title, but I'm reluctant to let go of the above concept as I think my separation of HTML/presentation and Javascript would be better if I could use the solution described above.
    So, does anybody know how to force the order of the columnNames in my output -- or what I'm doing to cause it to come out in a different order?
    Jeane

    Technically there isn't any "order" for the return columns. They aren't returned as an Array -- they're just properties on an Object instance (a "generic object"). The random order you're seeing is the behavior of the for..in loop iterating over the properties of the object. Unfortunately, with a for..in loop there is no guaranteed order for iterating over properties (and, as you've seen, it tends to vary wildly).
    The only solution is to create your own list of the column names and sort it the way you want to, then use that to create your output. For example, use the for..in loop to loop over the properties, but rather than actually get the values, just dump the column names into an Array:
    var columnName="";
    var columns = [];
    for (columnName in selResults.data[i]) {
        columns.push(columnName);
    columns = columns.sort(); // just uses the default alphabetical sort -- you would customize this if desired
    var j = 0;
    for (j = 0; j < columns.length; j++) {
        columnName = columns[j];
        output+=columnName + ":" + selResultsdata[i][columnName] + ";";

  • How to get cm:search to use the max attribute when creating the SQL query?

    When we use the max attribute in the cm:search tag, it does not seem to honor the max attribute when creating the SQL query. However, the result returned from the tag is limited to the number specified by the max attribute. Then the tag seems to work as intended, but the performance will be sub optimal when the SQL query returns unnecessary rows to the application.
    We use the cm:search tag to list the latest news (ordered by date), and with the current implementation we have to expect a decrease in performance over time as more news is published. But we can’t live with that. We need to do the constraint in the SQL query, not in the application.
    The sortBy attribute of cm:search is translated to “order by” in the SQL query, as expected.
    Is it possible to get cm:search to generate the SQL query with an addition of “where rownum <= maxRows”?

    Hi Erik,
    The behavior of a repository in regards to the search tag's max results parameter is dependent on the underlying repository's implementation. That said, the OOTB repository in WLP does augment the generated SQL to limit the number of rows returned from the database. This is done in the parsing logic. This behavior may differ with other repository implementations.
    -Ryan

  • XMLQuery starts using XMLSEQUENCEFROMXMLTYPE when adding filter to query

    Hi,
    I'm creating a single XML view on 3 relational tables. These table represent:
    1. a dataset description (table: refs)
    2. a keyset (table: keyset, a table with between refs )
    3. a data set (table: data, consisting of reference to key, value, and reference to a dataset)
    Per dataset I can have multiple keys, per key I have multiple values
    (1:N for dataset:keys, 1:N keys:values)
    The definition is given below:
    DROP TABLE data;
    DROP TABLE refs;
    DROP TABLE keyset;
    CREATE TABLE data (ref int, key int, value float);
    CREATE TABLE refs (ref int);
    CREATE TABLE keyset (key int, ref int);
    CREATE INDEX data_krv ON data (key,ref,value);
    CREATE INDEX keyset_kr ON keyset (key,ref);
    INSERT INTO refs VALUES (1);
    INSERT INTO refs VALUES (2);
    INSERT INTO data VALUES (1,1,1.5);
    INSERT INTO data VALUES (1,1,2.5);
    INSERT INTO data VALUES (1,2,3.5);
    INSERT INTO data VALUES (1,2,4.5);
    INSERT INTO data VALUES (2,1,5.5);
    INSERT INTO data VALUES (2,1,6.5);
    INSERT INTO data VALUES (2,2,7.5);
    INSERT INTO data VALUES (2,2,8.5);
    INSERT INTO keyset SELECT DISTINCT key, ref FROM data;
    CREATE OR REPLACE VIEW drk_xml_view OF XMLType
    with OBJECT ID
      extract(object_value,'/ref').getnumberval()
    AS
    SELECT xmlElement(
         "ref",
         xmlElement("ref_id", refs.ref),
         (SELECT xmlAgg(
                    xmlElement("key",
                      xmlElement("key_id",keyset.key),
                      xmlElement("values",
                          (SELECT xmlAgg(xmlElement("value",data.value))
                           FROM data
                           WHERE data.key=keyset.key AND data.ref=keyset.ref)
          FROM keyset WHERE refs.ref = keyset.ref
    ) FROM refs
    /When I do a query like:
    SELECT xmlQuery('for $i in /ref return max($i/key/values/value)' passing object_value returning content) from drk_xml_view;the explain plan looks as expected:
    | Id  | Operation              | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT       |           |     2 |    26 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE        |           |     1 |    65 |            |          |
    |   2 |   NESTED LOOPS         |           |     1 |    65 |     6   (0)| 00:00:01 |
    |*  3 |    INDEX FAST FULL SCAN| KEYSET_KR |     1 |    26 |     3   (0)| 00:00:01 |
    |*  4 |    INDEX RANGE SCAN    | DATA_KRV  |     1 |    39 |     3   (0)| 00:00:01 |
    |   5 |  SORT AGGREGATE        |           |     1 |       |            |          |
    |   6 |   FAST DUAL            |           |     1 |       |     2   (0)| 00:00:01 |
    |   7 |  TABLE ACCESS FULL     | REFS      |     2 |    26 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("KEYSET"."REF"=:B1)
       4 - access("DATA"."KEY"="KEYSET"."KEY" AND "DATA"."REF"=:B1)
           filter("DATA"."REF"="KEYSET"."REF")
    Note
       - dynamic sampling used for this statementThis is very nicely optimized.
    But now I do this one:
    SELECT xmlQuery('for $i in /ref[./ref_id<2] return max($i/key/values/value)' passing object_value returning content) from drk_xml_view;(where I only added a constraint on the /ref/ref_id) the following occurs:
    | Id  | Operation                          | Name                   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                        |     2 |    26 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                    |                        |     1 |     2 |            |          |
    |   2 |   COLLECTION ITERATOR PICKLER FETCH| XMLSEQUENCEFROMXMLTYPE |       |       |            |          |
    |   3 |  SORT AGGREGATE                    |                        |     1 |       |            |          |
    |*  4 |   FILTER                           |                        |       |       |            |          |
    |   5 |    FAST DUAL                       |                        |     1 |       |     2   (0)| 00:00:01 |
    |   6 |  TABLE ACCESS FULL                 | REFS                   |     2 |    26 |     3   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - filter(:B1<2)
    Note
       - dynamic sampling used for this statementSo, it doesn't use any index any more and creates a XMLSequenceFromXMLType instead. This one is then parsed which results in really bad performance.
    I've tried to add extra indexes to the tables, but that didn't result in an optimilization. From a SQL point of view this seems quite easy, but using the view it gives me problems.
    Is there someone who can explain me what is happening here? Or give me some pointers?
    Please let me know if you need to know more, or if something is unclear.
    Best regards

    SQL> SELECT xmlQuery('for $i in /ref where $i/ref_id < 2 return max($i/key/values/value) ' passing object_value returning content)
      2    from drk_xml_view
      3  /
    XMLQUERY('FOR$IIN/REFWHERE$I/REF_ID<2RETURNMAX($I/KEY/VALUES/VALUE)'PASSINGOBJECT_VALUERETURNINGCONTENT)
    4.5
    Execution Plan
    Plan hash value: 2754328746
    | Id  | Operation           | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |        |     2 |    26 |     2   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |        |     1 |    65 |            |          |
    |*  2 |   HASH JOIN         |        |     1 |    65 |     5  (20)| 00:00:01 |
    |*  3 |    TABLE ACCESS FULL| KEYSET |     1 |    26 |     2   (0)| 00:00:01 |
    |*  4 |    TABLE ACCESS FULL| DATA   |     1 |    39 |     2   (0)| 00:00:01 |
    |   5 |  SORT AGGREGATE     |        |     1 |       |            |          |
    |*  6 |   FILTER            |        |       |       |            |          |
    |   7 |    FAST DUAL        |        |     1 |       |     2   (0)| 00:00:01 |
    |   8 |  TABLE ACCESS FULL  | REFS   |     2 |    26 |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - access("DATA"."KEY"="KEYSET"."KEY" AND
                  "DATA"."REF"="KEYSET"."REF")
       3 - filter("KEYSET"."REF"=:B1)
       4 - filter("DATA"."REF"=:B1)
       6 - filter(:B1<2)
    Note
       - dynamic sampling used for this statement
    SQL>

  • OSB - Iterating over large XML files with content streaming

    Hi @ll
    I have to iterate over all item in large XML files and insert into a oracle database.
    The file is about 200 MB and contains around 500'000, and I am using OSB 10gR3.
    The XML structure is something like this:
    <allItems>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    <item>.....</item>
    </allItems>
    Actually I thought about using a proxy service with enabled content streaming and a "for each" action for iterating
    over all items. But for this the whole XML structure has to be materialized into a variable otherwise it is not possible!
    More about streaming large files can be found here:
    [http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html#large_messages]
    There is written "When you enable streaming for large message processing, you cannot use the ... for each...".
    And for accessing single items you should should use an assign action with a xpath like "$body/allItems/item[1]";
    this works fine and not the whole XML stream has to be materialized.
    So my idea was to use the "for each" action and processing seqeuntially all items with a xpath like:
    $body/allItems/item[$counter]
    But the "for each" action just allows iterating over a sequence of xml items by defining an selection xpath
    and the variable that contains all items. I would like to have a "repeat until" construct that iterates as long
    $body/allItems/item[$counter] returns not null. Or can I use the "for each" action differently?
    Does the OSB provides any other iterating mechanism? I know there is this spli-join construct that supports
    different looping techniques, but as far I know it does not support content streaming, is this correct?
    Did I miss somehting?
    Thanks a lot for helping!
    Cheers
    Dani
    Edited by: user10095731 on 29.07.2009 06:41

    Hi Dani,
    Yes, according to me this would be the best approach. You can use content-streaming to pass this large xml to ejb and once it passes successfully EJB should operate on this. If you want any result back (for further routing), you can get it back from EJB.
    EJB gives you power of java to process this file and from java perspective 150 MB is not a very LARGE data. Ensure that you are using buffering. Check out this link for an explanation on Java IO Streams and, in particular, buffered streams -
    http://java.sun.com/developer/technicalArticles/Streams/ProgIOStreams/
    Try dom4J with xpp (XML Pull Parser) parser in case you have parsing requirement. We had worked with 1.2GB file using this technique.
    Regards,
    Anuj

  • Strange Behavior: VO query result shown in UI different from backend

    Hi Experts,
    I have an issue with one of the VOs in my application. The VO uses an expert query.
    The application uses ADF faces for the front end. The UI is created by dragnDrop method from ViewCriteria(Datacontrol for this VO) to the page.
    I would expect the page to always show the data which I would get when I execute the query from the backend.
    But the data that comes up in the UI(through the VO and queryPanel, af:table) is different from the data set if I execute the query directly from backend. (Oracle 11G Database)
    The issue occurs for one set of data and not for another set of data.
    I tried the following:
    In VOImpl, the executeQuery method is overridden to add additional filters.
    Just before super.executeQuery, captured the getQuery() result.
    The query got this way, I am running from back-end(SQLPLUS/Toad) returns expected results, whereas when the Application is run, the UI table shows duplicate data for one set alone.
    Please share pointers on how to debug this issue further.
    Please note that this post is not about the query but I am illustrating the query here just in case its needed.
    The query is something like this:
    Fetch rows from maintable that belong to either the set mapping to :bindvariable1 or the set mapping to bindvariable2. This could be represented as a union between the two selects as well.
    select
    col1,col2,col3...
    from main_table, table1, table2
    where
    (main_table.idcolumn =:bindvariable1
    and table1.referencecolumn =:bindvariable1
    and table2.referncecolumn =:bindvariable1)
    or
    (main_table.idcolumn =:bindvariable2
    and table1.referencecolumn =:bindvariable2
    and table2.referncecolumn =:bindvariable2)
    and
    maintable.idcolumn2=table1.idcolumn
    and maintable.idcolumn3=table2.idcolumn
    Thanks for your time and help.
    Ganesh Iyer

    Do you have a security policy associated with the table?
    Oracle 8i supports virtual private database where the server can dynamically modify a query.
    The query 'SELECT * FROM EMP' could be modified by the server to 'SELECT * FROM EMP WHERE DIVISION = 'AIRCRAFT' by putting a security policy on the EMP table.
    You, as a user, would never know it happened.
    A security policy based on some arcane rule such as the time of day could cause the problem you are describing.
    The only other way I know of is if you logged in as two different users and each user has different privileges on the table.
    Good luck!
    null

Maybe you are looking for

  • How do I recover files from my HP Pocket Media Drive?

    My HP Pavilion g6 computer's hard drive crashed a couple weeks ago and as it was crashing, a pop-up showed up to tell me to back up all of my data. I hooked up my pocket media drive and waited until I read a message saying "files successfully backed

  • When Working With Your iMac Do You: Stand Up or Sit Down?

    Hi. New studies show that it's better for health and creativity to stand up for hours while working (with legs moving from time to time) vs. sitting down or is sitting down with a very good chair better than standing up if you want to have a clear mi

  • Using addInstance in a IF calculation

    Hi i am trying to get a addInstance to work unpon a IF result if  (test1.Headrow.TextField12 ==16) then _test1.addInstance(1); endif this works fine for the first time and a new subform is created, but unpon the second time its run in the new subform

  • Upgrade of GRC 5.2 to GRC AC 5.3

    Hello, During an upgrade of GRC AC 5.2 to GRC AC 5.3, when we uninstall GRC AC 5.2 and install GRC AC 5.3 on the same server, 1- Do we lose all existing configurations of GRC 5.2 eg. workflows, connectors, rule sets etc and will I lose existing reque

  • HELP i have a final tomorrow!

    let's say we have public class Animal, it contains some constants public static final int ANT; public static final int CAT; etc.. there is a constructor in class Animal, Animal a = new Animal (Animal.SHARK); give JUST the signature for this construct