I can´t select rownum in a query, when inner query contains SDO_ANYINTERACT

I have written a query in Oracle that looks like this:
select ID, NAME, GEOMETRY from
select a.*, rownum as rnm from
select ID, NAME, GEOMETRY from MY_TABLE
where SDO_ANYINTERACT(GEOMETRY, SDO_UTIL.SDO_GEOMETRY('POLYGON ((670000 6268000, 670000 6269000, 700000 6269000, 700000 6268000, 670000 6268000))')) = 'TRUE'
order by NAME asc
) a
where rnm <= 50 and rnm >= 40
The inner query is selecting rows from MY_TABLE using a bounding box. The outer queries are included to enable paging for the results.
For some odd reason this query does not yield any results. If I try and run the subquery:
select ID, NAME, GEOMETRY from MY_TABLE
where SDO_ANYINTERACT(GEOMETRY, SDO_UTIL.SDO_GEOMETRY('POLYGON ((670000 6268000, 670000 6269000, 700000 6269000, 700000 6268000, 670000 6268000))')) = 'TRUE'
order by NAME asc
It yields a list of results as expected. If i run the subquery:
select a.*, rownum as rnm from
select ID, NAME, GEOMETRY from MY_TABLE
where SDO_ANYINTERACT(GEOMETRY, SDO_UTIL.SDO_GEOMETRY('POLYGON ((670000 6268000, 670000 6269000, 700000 6269000, 700000 6268000, 670000 6268000))')) = 'TRUE'
order by NAME asc
) a
the result set is empty. Somehow rownum is preventing the query from yielding any results. If I remove rownum the results are returned as in the innermost query:
select a.* from
select ID, NAME, GEOMETRY from MY_TABLE
where SDO_ANYINTERACT(GEOMETRY, SDO_UTIL.SDO_GEOMETRY('POLYGON ((670000 6268000, 670000 6269000, 700000 6269000, 700000 6268000, 670000 6268000))')) = 'TRUE'
order by NAME asc
) a
What am I doing wrong here?? I am running Oracle 10g..
Edited by: user12456076 on 2010-01-15 06:14

What version of Oracle are you running?
I tried your query on 10.2.0.2 on some data I have and your query works properly.
Though I would shorten the query to:
select ID, NAME, GEOMETRY from
  select rownum as rnm, ID, NAME, GEOMETRY
    from MY_TABLE
   where SDO_ANYINTERACT(GEOMETRY, SDO_UTIL.SDO_GEOMETRY('POLYGON ((470000 5268000, 470000 5269000, 500000 5269000, 500000 5268000, 470000 5268000))')) = 'TRUE'
   order by NAME asc
) a
where rnm <= 50 and rnm >= 40;regards
Simon

Similar Messages

  • Can we have triggers that get fired when we Query a table?

    Hi All,
    What could be the pricise answer to the following question?
    1. Can we have triggers that get fired when we Query a table?
    2. What the relation of triggers and delete, truncate statement in one line?
    3. What is data modelling? Why is it necessary?
    4. Which are not mandatory but essential files in Oracle?
    Regards,
    AAK

    1. Can we have triggers that get fired when we Query a table?for INSERT, UPDATE and DELETE statement, yes
    for SELECT statement, no.
    Question 2 is not clear for me.
    Question 3 is very very general ...
    4 >Which are not mandatory but essential files in Oracle?
    all database files (initialization file, control files, datafiles, redo log files) are mandatory. What is not mandatory but considered as a (very) bad practice is
    to have only 1 control file and only 1 redo log group with 1 redo log file.

  • How to create a DB Adapter with select query having inner query

    Hi All,
    I am trying to create a DB Adapter with select query. The query has some inner queries in it. It is just like this select a, b, c, (select d from e) d, (select e from e) e from tablename.
    The problem here is with the xsd generated for this query. Xsd is not getting generated properly for all the fields it is just getting generated till c element and when it encounters
    the inner query it is stopping the generation of xsd. So for the above query the xsd is something similar to the below
    <xs:complexType name="rewOutput">
    <xs:sequence>
    <xs:element name="a" type="xs:string" nillable="true"/>
    <xs:element name="b" type="xs:string" nillable="true"/>
    <xs:element name="c" type="xs:string" nillable="true"/>
    <xs:element name="select_d" type="xs:string" nillable="true"/>
    </xs:sequence>
    </xs:complexType>
    as shown above the xsd is just getting generated till the first inner query. What should be done to get the full fledged xsd. Should it be manually built ?? Please help me on this.
    Thanks In Advance.
    Edited by: 959766 on Nov 30, 2012 1:20 AM

    Hi,
    I don't think the parser will be able to understand your query properly... I would try building the xsd manually...
    Cheers,
    Vlad

  • Can't select "Plain Paper" or "Automatic" when Printing in iPhoto

    When attempting to print a picture to plain paper in iPhoto 6, the program will not let me select "Plain Paper" or "Automatic" in the "Paper Type" drop down.
    See if you can duplicate the problem on your Mac this way:
    1) select a picture within your iPhoto library
    2) File > Print
    3) Choose Advanced, then in the third drop down menu, choose "Paper Type/Quality"
    4) Within the "Paper" tab, drop down the menu called "Paper Type"
    5) Can you select "Plain Paper" and/or "Automatic"?
    Perhaps this is Apple's way of saying they don't want us to print on anything but picture quality paper?? I hope not. I just want to print out some lined paper for my first grader to practice on.
    Thanks,
    STEVE

    The default setting for me appears to be plain paper. iPhoto won't let me choose 'photo quality' and when printing photos on the default setting on photo paper dark areas appear blotchy and the colours are too harsh. I'm using a HP 1205 all-in-one printer/scanner/copier, and the HP people seem baffled by this. The same printer, when connected to my former iBook computer, allowed me to choose different paper types.

  • How to ignore a variable defined in a query when the query gets executed

    Hi SAP guru, I am creating a query, which has a user input variable, say A, and a replacement path variable, say B, Bu2019s value is determined by A and the whole purpose of A is letting user entering an initial value and A must be ignored when the query gets executed. How can I achieve this in query designer?
    Thanks

    Hi, thanks for the reply. Actually this is not my problem. My problem is the query should be filtered by  a variable, say B, but B is not allowed to be entered directly by user (i.e. B could be a replacement path variable or user exit type). So B has to be derived from another user input variable, say A. However if I defined A in the query, A is by default used as one of the filters, which is not desirable because A is a subset of B in my case and should be ignored.
    Is there options (settings) that allow the query ignore a specified variable (A) ? If not is there other ways to get around this?
    Thanks
    MichScott

  • How to cancel a query when execute query builtin fire and No Records found.

    Hi,
    I am unable to cancel a query when i make query (fire enter-query) then fire (execute-query) and no records found then the form status is enter-query mode. Plz help me that how can i back to normal mode of form.
    here i use the code for coming back to enter-query to normal mode but no results.
         if :system.mode = 'ENTER-QUERY' THEN
    ABORT_QUERY;
         clear_form;          
         END IF;
    thanks in advance....

    Hello,
    I would test the record status of the first record in the block. If this status is 'NEW', then there is no record retrieved, so that you can exit the query mode with exit_form()
    Francois

  • CS3 Bugs - Can't select pictures... When is CS3 patch time?

    I can't seem to select pictures... I CAN select them, but the
    properties panel below doesn't change - so I can't change the
    various properties unless I go into code view... Not a major bug,
    but it's terribly annoying. I've had to leave DW8 installed in
    order to get work done.
    Everything else seems to be fine so far.

    Me too. Try rebooting?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "David Powers" <[email protected]> wrote in message
    news:f3kcmh$he2$[email protected]..
    > mason804 wrote:
    >> I can't seem to select pictures... I CAN select
    them, but the properties
    >> panel below doesn't change - so I can't change the
    various properties
    >> unless I go into code view...
    >
    > The Property inspector works just fine with images for
    me (Win XP Pro, 2GB
    > RAM). Perhaps there's something unusual about your setup
    or way of using
    > CS3. If you have reproducible steps, file a bug report
    here:
    >
    >
    http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
    >
    > --
    > David Powers, Adobe Community Expert
    > Author, "Foundation PHP for Dreamweaver 8" (friends of
    ED)
    > Author, "PHP Solutions" (friends of ED)
    >
    http://foundationphp.com/

  • Can't select apple tv in itunes when playing audio

    I have the airplay icon. I select the icon and I have 2 options. My computer and Apple TV. If I select Apple TV nothing happens. It remains on My computer. If I start playing audio through itunes then try and select Apple TV nothing changes again. The audio stays coming out of laptop speakers. If I play a video, then select Apple TV, this works.
    I had audio working the other day, but can't think of anything I might have done to change anything. But if video works, why doesn't audio?    

    Welcome to the Apple Community.
    Do you have the power cable in, it won't show up with the power cable in.
    Additionally, there have been some issues with the update servers, it's possible you won't be able to complete the update procedure anyway.

  • Can't Select Epson 3880 ABW [even when printer manages colors]

    I can't seem to figure out a problem I'm having trying to print using ABW mode on my Epson 3880 from LR5.3 - it is greyed out an inaccessible.  I'm familiar with the safety net that precludes double color management when LR is set to print with a profile.  But even when I have output set to "Managed By Printer" I still can't access ABW.  It's grayed out.
    What am I missing here?

    Is there a way to start from scratch in the driver settings? 
    Here is the Epson-Apple driver fix hocus pocus which is to delete all instances of Epson printers from System Preferences>Print & Fax.
    Then go to /Library/Printers and toss the whole Epson folder.
    Toss LFP Remote Panel (IF you are using this utility for your printer).
    Then reinstall drivers.
    When you go back to Print & Fax to add the printer, on 10.6 I had to wait almost a minute before the IP version of the printer showed up, whereas the Bonjour one shows up right away. Then add the IP instance of the printer. This is for printers on a network.
    Then re-install LFP Remote Panel if you use it with this printer.

  • Select more than 60 values at a query isn't possible?

    Post Author: fmonsma
    CA Forum: WebIntelligence Reporting
    I can't select more than 60 values at my query. We got id numbers. I want to select the name, adress, zipcode etc. of for example 80 id numbers. BO doesn't allow me to make this query. In SQL it's no problem.
    The only thing i can do is to make a query with all id numbers and in the report itself i can select this more than 60 values. This is not very handy if you havemore than 150,000 id's in your databases.

    Rather several select fields because single returned value is a functional limitation of <select>.

  • Can't Select Multiple speakers for AirTunes

    I have had a problem for the past few days now where i can't select to use multiple speakers when using AirTunes.
    This has never happened before, and was fine after the update to iTunes 7.
    Is there something i need to change / select in my AirPort preferences to make multiple speakers enabled?

    Do you have the latest Firmware of the AirPort Express V6.3?
    There could be a problem with older versions of the firmware and the new iTunes 7. Then I would also update iTunes to the newest version 7.0.1.

  • How do I create Themes/Chapters in my video before burning to DVD so that Scenes can be selected when DVD is loaded to player?

    How do I create Themes/Chapters in my video before burning to DVD so that Scenes can be selected using on screen icons when DVD is loaded to player?

    "I don't know what you mean by this. There are no chapter markers in FCP." - you puzzle me by this! Yave You ever made some DVDees after editing in FCP 7? Every chapter in the timeline could be transfered to DVD Studio Pro, and then used in DVD navigation. This is very important feature, decause you don't have to lookfor some parts of your video while creating navigation! Less work - more joy! Another downscore of FCPX!

  • Please help on how Bex execute the query designed in query designer.

    Hi All,
    Want to know how bex execute/interpret  the query when the query is execute in analyzer.
    I mean which part of the query is executed first, like  filter,RKF or CKF etc.
    Want to do step by step analysis .Please suggest on this.
    Thanks & Regards
    Sameer Khan

    HI,
    When u execute the query...It will fetch the Global filters data first ....means filters on Default values....then restrictions on Char Restriction pannnel....Then calculate the RKF and CKF,s....Conditions and Exeptions etc.......
    Thanks

  • Can I select the query elements of structure manually in transport conn

    Hello all,
    I am trying to select a structure and the elements of the structure manually in transport connection. I am able to slect the structure from from query elements -> structure but now how can i select (manually) the items like new selections and new formulas that are inlcuded in my structure.
    When I go and search for that query element in table V_ELTDIR_TXT it says that the the items of my structure are RKF but when i try to serach under query elements -> RKF i dont see them.
    Can someone help here.
    Thanks in advance

    Hi Kamaljeet ,
    you are trying to tell me that i can just slect my query and structure (manually..so basically only 2 query elements in transport request)...and transport that and it should take care of selections and formulas in structure.
    I have created a transport as per what you have told, waiting on basis to transport it. Will update you in few minutes.
    Thanks again

  • Rownum, Order by, inner-inner query

    I have a query where the current approach to handling rownum and order by's doesn't work and was wondering if anyone knew of a way around this. The basic query is as follows:
    Select *
    From <list of tables> T1
    Where....
    And t1.elig_id =
    (Select elig_id
    From (Select elig_id
    From eligibility T2
    where T1.family_number = T2.family_number
    order by date1 desc, date2 desc)
    Where rownum = 1)
    The problem is the T1.family_number = T2.family_number line. Since the join is in the inner-inner query sql does not recognize T1.family_number. Is there anyway around that?

    It is probably not materializing the sub query for every row in the outer select, but IN can be expensive if the sub-query returns a large number of rows. Another way to phrase the statement which may be faster is:
    SELECT t1.*
    FROM <list of tables> T1,
         (SELECT elig_id
          FROM (SELECT elig_id, ROW_NUMBER() OVER (PARTITION BY family_number
                                               ORDER BY date1 DESC date2 DESC) rn
                FROM eligibility)
          WHERE rn = 1) elig
    Where t1.elig_id = elig.elig_id and
          other_conditionsEssentially, use the sub-query as if it were a table (an in-line view actually), and join to it. This may make Oracle materialize it earlier and avoid the inlist processing.
    HTH
    John

Maybe you are looking for

  • Text missing in PDF files

    I have been trying to print out a form from a local university for my daughter. http://www.wlv.ac.uk/PDF/uow-direct-app-home.pdf I am using Leopard 10.5.2 - but when I preview this form in finder, nearly all of the text is missing. If I try to print

  • The computer has rebooted from a bugcheck. The bugcheck was: 0x0bad1001

    I would like to know how to troubleshoot this issue. The computer has rebooted from a bugcheck.  The bugcheck was: 0x0bad1001 (0x00000000000d04fd, 0xffffd00022fb6388, 0xffffd00022fb5b90, 0xfffff803552f9916). A dump was saved in: C:\WINDOWS\MEMORY.DMP

  • Sales difference day-by-day until today

    Hi I have a keyfigure Sales Volume  in my cube... I have calculated keyfigure Sales Difference which is calculated as 'Sales Volume Present Day'-'Sales Volume Previous Day'...Sales volume present day and previous day are based on kefigure 'Sales Volu

  • Error Installing Air 2.0 SDK

    When I try "install" Air2.0 SDK i have this error "Directory does not contain a Flex SDK". I unzip sdk into flex sdk folders and then open Flex Builder. Inside Flex Builder go to "Window"->"Preferences"->"Installed Flex SDKs"-> ADD and select my air

  • Printing to a printer shared on a PC from a Mac

    I have a PC running Windows XP Pro connected to a home network. I am trying to print to a Canon S530D printer shared on that PC. I can see the printer in the printer setup utility on my Mac but I don't know what to choose as the printer model, generi