No rows returned by spatial query wrapped in SELECT * FROM ...

Hi,
I'm getting some really weird behaviour when running a sub query with SDO_EQUAL. The SDO_EQUAL query on its own works fine, but if I wrap it in SELECT * FROM then I get no results. If I wrap SDO_ANYINTERACT in SELECT * FROM then I get the expected result.
It looks like the spatial index is used when running the regular SDO_EQUAL query, but not when wrapped in SELECT * FROM. Weird. The spatial index is also not used when SDO_ANYINTERACT is wrapped in SELECT * FROM... so I'm not sure why that returns the right answer.
I am getting this problem on 11.2.0.2 on Red Hat Linux 64bit and 11.2.0.1 on Windows XP 32bit (that's all the 11g versions I've tried). The query works as expected on 10.2.0.5 on Windows Server 2003 64bit.
Any ideas?
Confused in Dublin (John)
Test case...SQL>
SQL> -- Create a table and insert the same geometry twice
SQL> DROP TABLE sdo_equal_query_test;
Table dropped.
SQL> CREATE TABLE sdo_equal_query_test (
  2  id NUMBER,
  3  geometry SDO_GEOMETRY);
Table created.
SQL>
SQL> INSERT INTO sdo_equal_query_test VALUES (1,
  2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
  3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
1 row created.
SQL>
SQL> INSERT INTO sdo_equal_query_test VALUES (2,
  2  SDO_GEOMETRY(3003, 81989, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
  3  SDO_ORDINATE_ARRAY(1057.39, 1048.23, 4, 1057.53, 1046.04, 4, 1057.67, 1043.94, 4, 1061.17, 1044.60, 5, 1060.95, 1046.49, 5, 1060.81, 1047.78, 5, 1057.39, 1048.23, 4)));
1 row created.
SQL>
SQL> -- Setup metadata
SQL> DELETE FROM user_sdo_geom_metadata WHERE table_name = 'SDO_EQUAL_QUERY_TEST';
1 row deleted.
SQL> INSERT INTO user_sdo_geom_metadata VALUES ('SDO_EQUAL_QUERY_TEST','GEOMETRY',
  2  SDO_DIM_ARRAY(SDO_DIM_ELEMENT('X', 0, 100000, .0001), SDO_DIM_ELEMENT('Y', 0, 100000, .0001), SDO_DIM_ELEMENT('Z', -100, 4000, .0001))
  3  ,81989);
1 row created.
SQL>
SQL> -- Create spatial index
SQL> DROP INDEX sdo_equal_query_test_spind;
DROP INDEX sdo_equal_query_test_spind
ERROR at line 1:
ORA-01418: specified index does not exist
SQL> CREATE INDEX sdo_equal_query_test_spind ON sdo_equal_query_test(geometry) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
Index created.
SQL>
SQL> -- Ensure data is valid
SQL> SELECT sdo_geom.validate_geometry_with_context(sdo_cs.make_2d(geometry), 0.0001) is_valid
  2  FROM sdo_equal_query_test;
IS_VALID
TRUE
TRUE
2 rows selected.
SQL>
SQL> -- Check query results using sdo_equal
SQL> SELECT b.id
  2  FROM sdo_equal_query_test a, sdo_equal_query_test b
  3  WHERE a.id = 1
  4  AND b.id != a.id
  5  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
        ID
         2
1 row selected.
SQL>
SQL> -- Check query results using sdo_equal wrapped in SELECT * FROM
SQL> -- Results should be the same as above, but... no rows selected
SQL> SELECT * FROM (
  2       SELECT b.id
  3       FROM sdo_equal_query_test a, sdo_equal_query_test b
  4       WHERE a.id = 1
  5       AND b.id != a.id
  6       AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
  7  );
no rows selected
SQL>
SQL> -- So that didn't work.  Now try sdo_anyinteract... this works ok
SQL> SELECT * FROM (
  2       SELECT b.id
  3       FROM sdo_equal_query_test a, sdo_equal_query_test b
  4       WHERE a.id = 1
  5       AND b.id != a.id
  6       AND sdo_anyinteract(a.geometry, b.geometry) = 'TRUE'
  7  );
        ID
         2
1 row selected.
SQL>
SQL> -- Now try a scalar query
SQL> SELECT * FROM (
  2       SELECT b.id
  3       FROM sdo_equal_query_test a, sdo_equal_query_test b
  4       WHERE a.id = 1
  5       AND b.id != a.id
  6  );
        ID
         2
1 row selected.
SQL> spool offHere's the explain plan for the query that works. Note that the spatial index is used.
SQL> EXPLAIN PLAN FOR
  2  SELECT b.id
  3  FROM sdo_equal_query_test a, sdo_equal_query_test b
  4  WHERE a.id = 1
  5  AND b.id != a.id
  6  AND sdo_equal(a.geometry, b.geometry) = 'TRUE';
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 3529470109
| Id  | Operation                     | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT              |                            |     1 |  7684 |     3   (0)| 00:00:01 |
|   1 |  RESULT CACHE                 | f5p63r46pbzty4sr45td1uv5g8 |       |       |            |       |
|   2 |   NESTED LOOPS                |                            |     1 |  7684 |     3   (0)| 00:00:01 |
|*  3 |    TABLE ACCESS FULL          | SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
|*  4 |    TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
|*  5 |     DOMAIN INDEX              | SDO_EQUAL_QUERY_TEST_SPIND |       |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - filter("B"."ID"!=1)
   4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID")
   5 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
..... other stuff .....     Here's the explain plan for the query that does not work. Note that the spatial index is not used.
SQL> EXPLAIN PLAN FOR
  2  SELECT * FROM (
  3     SELECT b.id
  4     FROM sdo_equal_query_test a, sdo_equal_query_test b
  5     WHERE a.id = 1
  6     AND b.id != a.id
  7     AND sdo_equal(a.geometry, b.geometry) = 'TRUE'
  8  );
Explained.
SQL> @?/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
Plan hash value: 1024466006
| Id  | Operation           | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT    |                            |     1 |  7684 |     6   (0)| 00:00:01 |
|   1 |  RESULT CACHE       | 2sd35wrcw3jr411bcg3sz161f6 |       |       |            |          |
|   2 |   NESTED LOOPS      |                            |     1 |  7684 |     6   (0)| 00:00:01 |
|*  3 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3836 |     3   (0)| 00:00:01 |
|*  4 |    TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST       |     1 |  3848 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - filter("B"."ID"!=1)
   4 - filter("A"."ID"=1 AND "B"."ID"!="A"."ID" AND
              "MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
..... other stuff .....               

That looks like a bug to me. As a workaround, you can materialize the inline view by adding rownum>0. Please see the reproduction and workaround below.
SCOTT@orcl_11gR2> SELECT *
  2  FROM   (SELECT b.id
  3            FROM   sdo_equal_query_test a, sdo_equal_query_test b
  4            WHERE  a.id = 1
  5            AND    b.id != a.id
  6            AND    sdo_equal (a.geometry, b.geometry) = 'TRUE')
  7  /
no rows selected
Execution Plan
Plan hash value: 1024466006
| Id  | Operation          | Name                 | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT   |                      |     1 |  7676 |     6   (0)| 00:00:01 |
|   1 |  NESTED LOOPS      |                      |     1 |  7676 |     6   (0)| 00:00:01 |
|*  2 |   TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST |     1 |  3832 |     3   (0)| 00:00:01 |
|*  3 |   TABLE ACCESS FULL| SDO_EQUAL_QUERY_TEST |     1 |  3844 |     3   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   2 - filter("B"."ID"<>1)
   3 - filter("A"."ID"=1 AND "B"."ID"<>"A"."ID" AND
              "MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
Note
   - dynamic sampling used for this statement (level=2)
SCOTT@orcl_11gR2> SELECT *
  2  FROM   (SELECT b.id
  3            FROM   sdo_equal_query_test a, sdo_equal_query_test b
  4            WHERE  a.id = 1
  5            AND    b.id != a.id
  6            AND    sdo_equal (a.geometry, b.geometry) = 'TRUE'
  7            AND    ROWNUM > 0)
  8  /
        ID
         2
1 row selected.
Execution Plan
Plan hash value: 2329953927
| Id  | Operation                       | Name                       | Rows  | Bytes | Cost (%CPU)| Time     |
|   0 | SELECT STATEMENT                |                            |     1 |    13 |     3   (0)| 00:00:01 |
|   1 |  VIEW                           |                            |     1 |    13 |     3   (0)| 00:00:01 |
|   2 |   COUNT                         |                            |       |       |            |          |
|*  3 |    FILTER                       |                            |       |       |            |          |
|   4 |     NESTED LOOPS                |                            |     1 |  7676 |     3   (0)| 00:00:01 |
|*  5 |      TABLE ACCESS FULL          | SDO_EQUAL_QUERY_TEST       |     1 |  3832 |     3   (0)| 00:00:01 |
|*  6 |      TABLE ACCESS BY INDEX ROWID| SDO_EQUAL_QUERY_TEST       |     1 |  3844 |     3   (0)| 00:00:01 |
|*  7 |       DOMAIN INDEX              | SDO_EQUAL_QUERY_TEST_SPIND |       |       |     0   (0)| 00:00:01 |
Predicate Information (identified by operation id):
   3 - filter(ROWNUM>0)
   5 - filter("B"."ID"<>1)
   6 - filter("A"."ID"=1 AND "B"."ID"<>"A"."ID")
   7 - access("MDSYS"."SDO_EQUAL"("A"."GEOMETRY","B"."GEOMETRY")='TRUE')
Note
   - dynamic sampling used for this statement (level=2)
SCOTT@orcl_11gR2>

Similar Messages

  • How to restrict number of rows returned in a query

    Hi frnds,
    I'd like to restrict number of rows returned by my query to some 10 rows. how to do that.When I try doing with the rownum<10 its giving results for a particular dept and that too some 6 rows only...btw I'm grouping my table and includes joins from many a table and am ordering the table results by a column.. How to do this..

    776317 wrote:
    Hi frnds,
    I'd like to restrict number of rows returned by my query to some 10 rows. how to do that.When I try doing with the rownum<10 its giving results for a particular dept and that too some 6 rows only...btw I'm grouping my table and includes joins from many a table and am ordering the table results by a column.. How to do this..
    TELL ME HOW MANY ROWS YOU HAVE IN TABLE?
    Because you have only *6 rows* in you column, if you less than 10 rows then it displays only containied/exist rows. nothing much
    select ename,empno from emp where rownum < 10;Thanks

  • Number of rows returned in a query

    Is there a way to get the number of rows returned from a query without itterating through the itterator?
    Thanks,
    Yon

    No.
    Because rows are not all returned until you start interating.
    Some times I have seen people do a count query before the normal query, this helps out if you need a count to set things up.

  • Output the number of rows returned in a query

    How do I find out the number of rows that are returned in a query?
    COUNT function I guess can only be used when there is only one table involved. How do I do it for multi table query like JOIN?
    For example
    SELECT emp.first_name, emp.last_name, jobs.age FROM employees emp, jobs
    WHERE emp.employee_id=jobs.employee_id

    Hi,
    You can get the num of rows info
    select count(*) from (SELECT emp.first_name, emp.last_name, jobs.age FROM employees emp, jobs
    WHERE emp.employee_id=jobs.employee_id) ;
    regards
    Jafar
    http://www.oracledbarea.blogspot.com

  • Req. the script for sending the rows returned by a query to my mail id.

    Hi ,
    Can anyone send me the script, for this thing.
    Actually i am working on production side, and i am executing the query which will return the rows of mview name which are not getting refreshed with the specified frequency. so i want those rows returned by query to be send to my mail id.
    Thanks a lot..
    With Regards
    Vedavathi.E

    Hello,
    Please review the following link;
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_smtp.htm#sthref15607
    Adith

  • Spatial Query with multiple geometries from 2 tables

    Hi,
    I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
    I want to find all polygons where one of this points is within it...
    This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
    For the session running the query I've allocated 16M sort area with
    ALTER SESSION SET SORT_AREA_SIZE=16777216;
    Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
    SELECT lu.LNU_PARCEL_ID
         FROM
              seventy.PARCEL_OVERLAPS po,
              imap_topol.TP$_PARCEL_AREAS pa,
              TP$_PARCEL_CENTROID_AREA pca,
              TDCR_LAND_UNIT lu
         WHERE
              SDO_FILTER(po.geometry, pa.area,
              'querytype=WINDOW') = ’TRUE’ and
              sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
              pa.delete_date is null and
              Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
              pa.AREA_ID = pca.AREA_ID and
              pca.DELETE_DATE IS NULL and
              pa.DELETE_DATE IS NULL;

    Albert,
    Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
    12:26:29 [email protected]:SQL> select count(*)
    13:46:22 2 from seventy.PARCEL_OVERLAPS;
    COUNT(*)
    612
    13:48:12 [email protected]:SQL> select count(*)
    13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
    13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
    13:48:21 4 where pca.DELETE_DATE IS NULL
    13:48:21 5 and pa.DELETE_DATE IS NULL
    13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
    COUNT(*)
    1310665
    There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
    so the explan plan for
    14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
    14:38:50 2 SELECT lu.LNU_PARCEL_ID
    14:38:50 3 FROM
    14:38:50 4 seventy.PARCEL_OVERLAPS po,
    14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
    14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
    14:38:50 7 TDCR_LAND_UNIT lu
    14:38:50 8 WHERE
    14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
    14:38:50 10 pa.delete_date is null and
    14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
    14:38:50 12 pa.AREA_ID = pca.AREA_ID and
    14:38:50 13 pca.DELETE_DATE IS NULL and
    14:38:50 14 pa.DELETE_DATE IS NULL;
    is
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 4G|32920G| 547M| | |
    | NESTED LOOPS | | 4G|32920G| 547M| | |
    | MERGE JOIN | | 547M| 2029G| 230124 | | |
    | SORT JOIN | | 1M| 36M| 85014 | | |
    | MERGE JOIN | | 1M| 36M| 50019 | | |
    | SORT JOIN | | 1M| 17M| 21650 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
    | SORT JOIN | | 1M| 22M| 28369 | | |
    | TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
    | SORT JOIN | | 42K| 160M| 145111 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    14:43:14 [email protected]:SQL> explain plan for
    14:43:23 2 SELECT pa.AREA_ID
    14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
    14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
    14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:43:23 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 10M| | |
    | NESTED LOOPS | | 6M| 50G| 10M| | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    14:45:03 [email protected]:SQL> explain plan for
    14:45:04 2 SELECT pa.AREA_ID
    14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
    14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
    14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:45:05 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 863554 | | |
    | NESTED LOOPS | | 6M| 50G| 863554 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    --------------------------------------------------------------------------------

  • Need to limit number of rows returned by a query

    Hi. Is there a way to limit the rowsets returned to me in a query? I need to get the first 100, then the next hundred, etc until there are no more rows left to retrieve. Someone told me that I should use a cursor to do this. Does anyone have a specific example? Can this be done with a combination of SQL/JDBC?
    Thanks in advance...bbetta
    null

    if you are talking about limiting the number of rows to be returned to the calling program to a managable number of rowa ...
    for example the result set size would be 5000 rows and you want to get them in batches of 50 or 100 ..
    see the attached link :
    JDBC Code Templates
    http://technet.oracle.com/sample_code/tech/java/sqlj_jdbc/htdocs/templates.htm#BatchSize
    if you want the server side transaction to only return the first 50 or 100 rows even though the result set has more ... then
    another approach is required -- possibly as suggested above ...

  • Ejb ql query language inheritance Select From

    Hi,
    I am using TopLink MySQL ejb 3.0 persistence API.
    My question is:
    How can I write a query that would find only a subclass.?
    I hope this shows what I want.
    @Entity
    class Related{
    Parent parent;
    @Entity (inheritance=InheritanceType.JOINED)
    class Parent{
    String address;
    @Entity
    class Child extends Parent{
    String name;
    }How can I write this query?? I will write in Java style!
    1- Select a from Related a where a.parent (is instanceof (Child))????
    2- Select a from Related a where {
    if(a.parent instanceof Child){
    Child c=(Child) a.parent;
    c.name="criteria";
    }The idea is selecting those records from Related where it has reference to Child with a specific Criteria.
    Thank you.

    I figured it out,
    It was just a plain query with the specific types I needed.
    Thank you.

  • How to get total number of rows return by query

    hi all
    i am using forms 6i with oracle 10G in windows environment....
    i have a tabular form now i want to know that how many rows return by the query...like when user click on enter query and then give any search criteria and then execute query..it displays the records but i want to count the records that how many rows are return.............
    hope you understant what i mean
    Thanks in advance
    Regards

    U can use
    "Select count(*) from <table> where <condition>"
    <condition> is the where clause being used during "Execute Query"
    this will give u the no of records in query.
    And second option is to take a summary column. whose function is set "COUNT" and
    "Summarized item" should contain a column that will never be blank. After execute query this column will give u no of records in block.
    Regards....

  • How do you limit the number of rows return from query?

    How do you limit the number of rows return from query? Do all databases support this kind of feature?

    i think the standard is limit
    to get the top 30
    select * from mytable LIMIT 30;returns the first 30 rows
    also if you want a range
    select * from mytable LIMIT 10,30;returns 30 rows starting from 10
    this last one is useful for displaying ranges... something similar happens in these forums when viewing topics and messages

  • Query rows returned VS csv rows downloaded

    Does anyone know whether it's possible to have the rows returned by the query to the default of 500 but the actuall rows downloaded in the .csv file to be all the rows that would have been returned from the query? (otherwise the performance of the query is too slow if you try and get the limit of 10,000 rows)
    Thanks
    Alice

    Alice,
    You can define the number of rows on a page (using number of rows) and the total number of rows retrieved from your query (using max row count). The total number is what’s returned when you export your report as a CSV file. And if you’re page renders too slowly when you set the total number of rows to 10000, you could try using the simple pagination style “Row Ranges X to Y”. With this pagination style, the report would only process your result set up to the max row shown on the current page.
    Regards,
    Marc

  • How to create spatial query (sdo_relate) on 2 views

    Hi, I want to create a spatial query in the form of:
    select /*+ORDERED*/ column1,column2
    from view1,view2
    where sdo_relate(view2.geometry,view1.geometry,'mask= ... ')Both views are very fast and return a smal number of rows out of a large dataset. I would expect that running the spatial query on this selection should be fast but when performing the above query it takes quite some time.
    It seems that the spatial query is performed on the underlying tables before the views make their selection.
    What is a good way to handle this kind of problem? How to make the spatial query to be executed on the resultset of the views?
    thanks Rene

    Hi Udo,
    Let me tell you a bit more about the requirements of the application.
    We have a table with geometries. Some geometries are buildings, others are roads, trees, parking areas, etc.
    We let users specify what geometries they are interested in. This can be the type (tree, building) or a list of types, plus some other selection such as type of tree, name of road etc. Based on the specifications the application creates a view that returns exactly the geometries the user is interested in.
    Users may not only be interested in just a tree but may be looking for a tree located inside a building, or a building within a certain distance from a road. This then would be the query I am talking about in this post. Two views and a spatial relationship between them.
    Depending on the definition of the views and the data currently loaded the number of rows returned by the views will vary. I can't be there all the time making sure that the correct table is queried first and the correct hints are given. This is why we have the CBO. But it seems to do a poor job when it comes to spatial queries.
    Rene

  • Limiting number of rows returned by SQVI

    I've created a query in SQVI and I need to limit the number of rows returned by the query.  (I'm using the query as an exploratory tool, and it's not easy to predict how many records will be returned based on the selection fields I'm using.)
    Is there any way to add a 'Maximum No. of Hits' field to the SQVI selection screen similar to what is found when using SE16?
    Thanks,
    Bob

    It's not surprising that you are confused because the documentation doesn't bother to explain what the "fetch size" actually is, it just says that setFetchSize sets it and getFetchSize gets it. As I understand it from some other documents I read about JDBC, the fetch size is a number that may be used internally by the JDBC driver. Here's an example of how I understand it (others, I know you will feel free to correct me if you disagree):
    When the driver produces a result set with a very large number of records, it has to generate those records and deliver them to the system that requested them. If the database is not on the same system, then those records must all travel over the network. It could be a performance problem if you had to wait for (say) 80,000 records to travel across the network. Enter the fetch size. If you set the fetch size to 100, then the driver will bring the records across in batches of 100, as the program calls for them. Now, this buffering is transparent to your program; the driver doesn't tell you that it's getting another batch and you can't tell it to get another batch. So it is not a solution to the problem that everybody has here, namely how to display your records 10 per page and allow the user to go back and forth among those pages, like search engines do.

  • Getting the number of rows returned from ResultSet

    Hi,
    Does anyone know a method to get the number of rows returned with a query using the Resultset class?
    Thanks.

    Hi 281080,
    If your database and JDBC driver support it, in order to use the solution that da-alexj has suggested, you need to create a 'scrollable' "ResultSet" -- the javadoc for method "createStatement()" (in class "java.sql.Connection") has more details.
    However, I have found with Oracle 8.1.7.4 database and Oracle (thin) JDBC driver, that part of their implementation of the "last()" method (in class "java.sql.ResultSet") is to actually iterate through the entire "ResultSet" in order to reach the last row. If your "ResultSet" is very large (I tested it with a 100,000 row "ResultSet"), this will take a long time.
    Just wanted to make you aware of that.
    Of-course, this may be irrelevant to you since I didn't see any mention in your post of what database and JDBC driver you are using.
    Hope this has helped you, anyway.
    Good Luck,
    Avi.

  • Total Rows returned in interactive report

    Hi
    I have an interactive report that displays a warning message if more than 200 rows are returned. Is there anything within APEX that tells me the exact number of rows returned in my report, or at the very least if my report has exceeded my 200 row limit?
    I have a button on my page that I only want to display if the number of rows returned in my query is <= 200.
    I know that I could use say NDS to execute my select statement in order to determine the number of rows as a seperate statement - but this seems a bit of over-kill.
    Many thanks
    Paul

    M Tajuddin wrote:
    Hi Paul,
    You can change the this from report attributes. Click on Edit page >> click on the Interactive report >> click on Report Attributes on the top >> down the bottom there is an option where you can change the row numbers and error message etc.
    Hope this helps,
    M Tajuddin
    http://tajuddin.whitepagesbd.com
    Hi
    I dont want to modify the number of rows returned. I just want to know how many rows are returned so that I can display or hide a button.
    Thanks
    Paul

Maybe you are looking for

  • How to disable the 30 seconds of CDROM installer when connecting via USB?

    A few days ago my wife and I acquired two Samsung Galaxy S3 phones as our first smart phones.  When I connect either phone to any of the three different Windows 7 computers I have tried, the phone mounts as a virtual CDROM containing a Verizon softwa

  • Performance in processing 80,000 records.

    Hi I am working on a module where I have to upload a file of 80,000 records, process them and then upload them in Web Service. I am uploading file by simply parsing request items = upload.parseRequest(request);After this I am traversing entire file l

  • Storage clause of create partition based on last storage value

    Hello, could you give some advice how could i resolve this problem ? I have procedure which is executed by job every day, once a day, and what it does, it automaticly add new partitions on one table. I am now strugling with how to construct statement

  • Testting silk codec between skype and lync.

    After provisioning of Microsoft Lync Server and Skype Connectivity. which codec they are use? we want to test silk codec for our new recorder software programs. If lyc and skype will use silk codec it good news. could you please help us?

  • Tweaking Text to Speech

    I wish to create more time (i.e. dead air) between paragraphs when Text to Speech is turned on and in use. How do I do it? I've tried spaces, paragraph returns, & punctuation, nothing slows the voice. (There have been some amusing moments.) If there