Query with ROWNUM - does it scan the entire table? or returns once the limit is reached?

Suppose I have a table with 50k records.
I am running a query like the one below
select *
from sometable
where ROWNUM < 10 AND AnotherCondition='y'
In the above query, I can think of two possible ways to come up with the answer
1. Scan and apply filter condition on ALL the rows, and return the first 10
2. Do the things mentioned in option (1) but stop scanning once the record limit of 10 is reached. Don't scan the rest since it is not required.
I would like to know which of the following approaches does Oracle follow?  Or, does it follow any other strategy that is not mentioned above?
Has anyone done any tests to find out the answer for the above question?  If so, could you please share the findings?
Thanks in advance.
Regards,
Vivek Ganesan

Thanks! But where would I run the sql statement. When anyone launches the application it creates the database files in their user directory. How would I connect to the database after that to execute the statement?
I see the create table statements in the files I have pulled into NetBeans in both the source folder and the distribution folder. Could I add the statement there before the table is created in the jar file in the distribution folder and then re-compile it for distribution? OR would I need to add it to the file in source directory and recompile those to create a new distribution?
Thanks!

Similar Messages

  • When I connect my nano to my computer I receive the following message: There is a problem with this drive. Scan the drive now and fix it. My computer recognizes the ipod but the play lists saved in my itunes library are not the playlists that are on my na

    When I connect my nano to my computer I receive the following message: There is a problem with this drive. Scan the drive now and fix it.
    In addition, when I connect my nano, my computer does recognize but the library and playlists in my Itunes is not the same as the library/playlists on my ipod (on this ipod). If I purchase new songs from itunes, they go to the library on the computer but I cant get them to the ipod playlist.

    bump, I have same issue. thanks, MM

  • A query with respect to creation of the  shared Objects.

    Hi ,
    I am having a query with respect to creation of the  shared Objects.
    I have seen a example where the Author is creatining Shared Object as shown
    below :
    SharedObj = null;
    sharedObj = SharedObject.getLocal("myTasks");
    and there is nothing related to the word "myTasks" anywhere in the Application .
    Can anybody please let me know what is this word "myTasks" mean here ??
    Thanks in advance .

    hi,
    With a shared object it will create one if it doesn't exist, so "myTasks" will become the shared object name or if it exists it will load any objects that are within that shared object.
    Below is a simple example that uses sharedobjects to store login details.
    http://gumbo.flashhub.net/login/
    David

  • Sync Problem - "There is a problem with this drive. Scan the drive now and fix it".

    Have new desktop computer with Windows 8.When I connect my iPod to my computer to sync, I get the message – “There is a problem with this drive. Scan the drive now and fix it”. It is identifying the drive on the iPod as the problem. iPod works fine on my laptop computer and older desktop (both with Windows Vista). iTunes seems to momentarily recognize my iPod then it doesn't.  Any thoughts about a fix?

    bump, I have same issue. thanks, MM

  • Ipod classic says when trying to sync, Problems with this drive. Scan the drive and fix it ...what do i have to do?

    When trying to sync my ipod classic I get an error message " owners IPO (I)...Problems with this drive..Scan the drive and fix it now.....How am i supposed to scan the drive and fix it?

    Hi chiefdon,
    If you are having syncing and possibly disk issues with your iPod classic, you may find the steps outlined in the following Troubleshooting Assistant helpful:
    Apple Support: iPod classic Troubleshooting Assistant
    http://www.apple.com/support/ipod/five_rs/classic/
    Regards,
    - Brenden

  • Query with rownum

    Here's a tricky one that has stumped me. I have two queries below :
    The first query should list me records ordered by apxl_log_id field desc(first 50).
    The second query should list me records ordered by apxl_log_id field desc(first 100). The only difference is in the number of records retrieved.
    In other words, all 50 records in the first query should be there in the second query results as well !! because i am ordering it in descending order of apxl_log_id field.
    However, The first query gives me starting with 2268 whereas the other one starts with 2283. My questions is, where are the records in the second query with apxl_log_id from 2268 to 2282 ? (there are 15 of them missing) ?
    What could be the reason ?
    SELECT apxl_log_id,apxl_srvr_nm FROM apxl_appl_xcptn_log WHERE ROWNUM <= nvl(50,(select count(*) from apxl_appl_xcptn_log))
    ORDER BY apxl_log_id desc
    Gives me, 2283
    2268     NOT SPECIFIED
    2267     NOT SPECIFIED
    2266     NOT SPECIFIED
    2265     NOT SPECIFIED
    2264     NOT SPECIFIED
    2263     NOT SPECIFIED
    2262     NOT SPECIFIED
    2261     NOT SPECIFIED
    2260     NOT SPECIFIED
    2259     NOT SPECIFIED
    2190     NOT SPECIFIED
    2113     NOT SPECIFIED
    2112     NOT SPECIFIED
    2111     NOT SPECIFIED
    2110     NOT SPECIFIED
    2109     NOT SPECIFIED
    2108     NOT SPECIFIED
    2107     NOT SPECIFIED
    2081     NOT SPECIFIED
    1925     NOT SPECIFIED
    1917     NOT SPECIFIED
    1916     NOT SPECIFIED
    1915     NOT SPECIFIED
    1914     NOT SPECIFIED
    1913     NOT SPECIFIED
    1912     NOT SPECIFIED
    1911     NOT SPECIFIED
    1910     NOT SPECIFIED
    1885     NOT SPECIFIED
    1876     NOT SPECIFIED
    1874     NOT SPECIFIED
    1872     NOT SPECIFIED
    1871     NOT SPECIFIED
    1870     NOT SPECIFIED
    1869     NOT SPECIFIED
    1865     NOT SPECIFIED
    1864     NOT SPECIFIED
    1863     NOT SPECIFIED
    1848     NOT SPECIFIED
    1847     NOT SPECIFIED
    1846     NOT SPECIFIED
    1839     NOT SPECIFIED
    1837     NOT SPECIFIED
    1831     NOT SPECIFIED
    1830     NOT SPECIFIED
    1829     NOT SPECIFIED
    1828     NOT SPECIFIED
    1827     NOT SPECIFIED
    1822     NOT SPECIFIED
    1819     NOT SPECIFIED
    SELECT apxl_log_id,apxl_srvr_nm FROM apxl_appl_xcptn_log WHERE ROWNUM <= nvl(100,(select count(*) from apxl_appl_xcptn_log))
    ORDER BY apxl_log_id desc
    2283     NOT SPECIFIED
    2282     NOT SPECIFIED
    2281     NOT SPECIFIED
    2278     NOT SPECIFIED
    2277     NOT SPECIFIED
    2276     NOT SPECIFIED
    2275     NOT SPECIFIED
    2274     NOT SPECIFIED
    2273     NOT SPECIFIED
    2272     NOT SPECIFIED
    2268     NOT SPECIFIED
    2267     NOT SPECIFIED
    2266     NOT SPECIFIED
    2265     NOT SPECIFIED
    2264     NOT SPECIFIED
    2263     NOT SPECIFIED
    2262     NOT SPECIFIED
    2261     NOT SPECIFIED
    2260     NOT SPECIFIED
    2259     NOT SPECIFIED
    2237     NOT SPECIFIED
    2236     NOT SPECIFIED
    2235     NOT SPECIFIED
    2234     NOT SPECIFIED
    2233     NOT SPECIFIED
    2232     NOT SPECIFIED
    2190     NOT SPECIFIED
    2138     NOT SPECIFIED
    2137     NOT SPECIFIED
    2133     NOT SPECIFIED
    2132     NOT SPECIFIED
    2131     NOT SPECIFIED
    2130     NOT SPECIFIED
    2129     NOT SPECIFIED
    2128     NOT SPECIFIED
    2127     NOT SPECIFIED
    2126     NOT SPECIFIED
    2125     NOT SPECIFIED
    2124     NOT SPECIFIED
    2123     NOT SPECIFIED
    2122     NOT SPECIFIED
    2121     NOT SPECIFIED
    2120     NOT SPECIFIED
    2119     NOT SPECIFIED
    2118     NOT SPECIFIED
    2117     NOT SPECIFIED
    2116     NOT SPECIFIED
    2113     NOT SPECIFIED
    2112     NOT SPECIFIED
    2111     NOT SPECIFIED
    2110     NOT SPECIFIED
    2109     NOT SPECIFIED
    2108     NOT SPECIFIED
    2107     NOT SPECIFIED
    2106     NOT SPECIFIED
    2105     NOT SPECIFIED
    2104     NOT SPECIFIED
    2103     NOT SPECIFIED
    2102     NOT SPECIFIED
    2081     NOT SPECIFIED
    2017     test
    1925     NOT SPECIFIED
    1923     NOT SPECIFIED
    1922     NOT SPECIFIED
    1921     NOT SPECIFIED
    1920     NOT SPECIFIED
    1919     NOT SPECIFIED
    1918     NOT SPECIFIED
    1917     NOT SPECIFIED
    1916     NOT SPECIFIED
    1915     NOT SPECIFIED
    1914     NOT SPECIFIED
    1913     NOT SPECIFIED
    1912     NOT SPECIFIED
    1911     NOT SPECIFIED
    1910     NOT SPECIFIED
    1886     test
    1885     NOT SPECIFIED
    1876     NOT SPECIFIED
    1874     NOT SPECIFIED
    1872     NOT SPECIFIED
    1871     NOT SPECIFIED
    1870     NOT SPECIFIED
    1869     NOT SPECIFIED
    1865     NOT SPECIFIED
    1864     NOT SPECIFIED
    1863     NOT SPECIFIED
    1848     NOT SPECIFIED
    1847     NOT SPECIFIED
    1846     NOT SPECIFIED
    1839     NOT SPECIFIED
    1837     NOT SPECIFIED
    1832     NOT SPECIFIED
    1831     NOT SPECIFIED
    1830     NOT SPECIFIED
    1829     NOT SPECIFIED
    1828     NOT SPECIFIED
    1827     NOT SPECIFIED
    1822     NOT SPECIFIED
    1819     NOT SPECIFIED

    Order by is applied after the where clause, so you query returns the first 50 or 100 random rows and then orders them.
    You need to use an in line view like this
    select * from
      SELECT apxl_log_id,apxl_srvr_nm
      FROM apxl_appl_xcptn_log
      ORDER BY apxl_log_id desc
    WHERE ROWNUM <= nvl(50,(select count(*) from apxl_appl_xcptn_log))

  • How to create an ABAP Query with OR logical expression in the select-where

    Hi,
    In trying to create an ABAP query with parameters. So it will select data where fields are equal to the parameters entered. The default logical expression is SELECT.. WHERE... AND.. However I want to have an OR logical expression instead of AND.. how can I attain this??
    Please help me on this.. Points will be rewarded.
    Thanks a lot.
    Regards,
    Question Man

    Hi Bhupal, Shanthi, and Saipriya,
    Thanks for your replies. But that didn't answer my question.
    Bhupal,
    You cannot just replace AND with OR in an ABAP QUERY. ABAP QUERY is a self generated SAP code. You'll just declare the tables, input parameters and output fields to be displayed and it will create a SAP standard code. If you'll try to change the code and replace the AND with OR in the SAP standard code, the system will require you to enter access key/object key for that particular query.
    Shanthi,
    Yes, that is exactly what need to have. I need to retireve DATA whenever one of the conditions was satisfied.
    Saipriya,
    Like what I have said, this is a standard SAP code so we can't do your suggestion.
    I have already tried to insert a code in the ABAP query (there's a part there wherein you can have extra code) but that didn't work. Can anybody help me on this.
    Thanks a lot.
    Points will be rewarded.
    Regards,
    Question Man

  • Problem in Query with JOIN Function in OCRD CRD1 OCPR tables

    Hello Dear Forum Users,
    I want to make a query which shows me per business partner from OCRD - Addres; CRD1 - Delivery Address and from OCPR - Contactperson information
    Is it possible to show it in one row per Business Partner. Now I get (the classic problem) of several rows and a duplication of the contact persons per (delivery) address.
    My query is:
    SELECT T0.[CardCode], T0.[CardName], T1.[Address], T1.[Street], T1.[ZipCode], T1.[City], T1.[Country], T1.[U_TelNr], T1.[U_MobNr], T1.[U_OpenTijd], T1.[U_LosIns_1], T1.[U_LosIns_2],T2.[Title],  T2.[Name] as 'Voornaam', T2.[Address] as 'Achternaam', T2.[Position] as 'Functie', T2.[Tel1], T2.[Cellolar], T2.[E_MailL], T2.[BirthDate] FROM OCRD T0 LEFT OUTER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode LEFT OUTER JOIN OCPR T2 ON T0.CardCode = T2.CardCode
    Can you help me ?
    Jos Dielemans - Maastricht
    Edited by: J. Dielemans on Apr 29, 2011 4:28 PM
    Changed the query with Left Outer Join

    I have found the solution myself:
    By using the Union All function I could combine two queries. Here is the result:
    SELECT
    T0.[CardCode], T0.[CardName], T1.[Address] , T1.[Street], T1.[ZipCode], T1.[City], T1.[Country], T1.[U_TelNr], T1.[U_OpenTijd] , T1.[U_LosIns_1] , T1.[U_LosIns_2]'
    FROM OCRD T0 LEFT OUTER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode
    WHERE T0.[CardCode] >= 'D00000'
    Union all
    SELECT
    T0.[CardCode], T0.[CardName], T2.[Position], T2.[Tel1], T2.[Title],  T2.[Name], T2.[Address], T2.[Position], T2.[Tel1], T2.[Cellolar], T2.[E_MailL]
    FROM OCRD T0 LEFT OUTER JOIN OCPR T2 ON T0.CardCode = T2.CardCode
    WHERE T0.[CardCode] >= 'D00000'
    Order by 1
    Now i got the result I was looking for.

  • How does MAP scan the network

    Hi everyone, just sending you this email hoping you can support on the following:
    Do you have any document or presentation that explains how the data is gathered through the MAP tool from a pure technical perspective? (How is the data gathered,how the tool works while scanning,what will the tool access while
    doing the scanning, will there be anything left on the server after the tool is removed etc …)
    I need this to share it with a customer who’s quite worried about the risks his environment will be exposed to by running the tool? Appreciate your help.

    Hi,
      Greetings of the day!
    There are many ways of achieving the above and the easiest way is mentioned on the link attached below :-
    http://windows.microsoft.com/en-in/windows/rename-printer#1TC=windows-7
    The above applies to other windows OS as well as win7.
    And to make it meaning ful, you would need to get creative  
    If you have any queries related to the same OR any other do reply.
    Regards,
    Mohammed

  • Query with many sub-selects on the same table

    Hi,
    Please consider the example below (Oracle 11g):
    create TABLE test1 (order_id number, CODE VARCHAR2(10), VALUE NUMBER);
    insert into test1 VALUES (1, 'A', 100);
    insert into test1 VALUES (1, 'B', 200);
    insert into test1 VALUES (1, 'C', 300);
    insert into test1 VALUES (1, 'D', 400);
    insert into test1 VALUES (2, 'A', 10);
    insert into test1 VALUES (2, 'B', 20);
    SELECT order_id,
           CODE,
           VALUE,
           (SELECT VALUE FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code = 'B') b_Value,
           (SELECT SUM(VALUE)/COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_Value,
           (SELECT COUNT(*) FROM test1 t1
           WHERE t1.order_id = t.order_id
           AND   t1.code IN ('C', 'D')) cd_qty
    FROM   TEST1 t
    WHERE  CODE = 'A';In my real-life case, I don't have 3 but tens of sub-query columns like those. The performance is OK but I was wondering whether there were a better way in terms of performance and maintainability to write this query.
    I thought of the WITH clause but couldn't see how it could help much.
    Please note that some sub-queries can be more complex than just looking up a column, like in column cd_value/cd_qty.
    Any suggestions?
    Thanks
    Luis

    Simpler, but will go for two table scans. You will have to use outer joins according to your requirement.
    select t1.order_id,
           t1.CODE,
           t1.VALUE,
           max(decode(t2.code,'B',t2.value)) b_value,
           sum(decode(t2.code,'C',t2.value,'D',t2.value,0))/nullif(sum(decode(t2.code,'C',1,'D',1,0)),0)  cd_value,
           sum(decode(t2.code,'C',1,'D',1,0))  cd_qty 
    from TEST1 t1,test1 t2
    where t1.CODE = 'A'
    and t1.ORDER_ID = t2.order_id
    group by t1.order_id,
           t1.CODE,
           t1.VALUEEdited by: jeneesh on Feb 7, 2012 11:54 AM

  • Can I query with a select statement in the from statement

    I'm working with an application that creates a MASTERTABLE that keeps track of DATATABLEs as it creates them. These data tables are only allowed to be so big, so the data tables are time stamped. What I need to do is to be able to query the MASTERTABLE to find out what the latest datatable is and then query the specific datatable.
    I've tried
    select count(*) from (select max(timestamp) from mastertable)
    and it always comes back with a count of 1.
    Is this possible, or is there a better way?

    Well, I'm trying to understand... and if I understand, then you need something dynamic. I did create the following example, of course not exactly as yours (I don't have your data). Each employee has a table with his name, containing the sal history, and I want to query that table starting from actual sal :
    SCOTT@db102 SQL> select ename from emp where sal= 3000;
    ENAME
    SCOTT
    FORD
    SCOTT@db102 SQL> select * from scott;
    SAL_DATE         SAL
    01-JAN-85       2500
    01-JAN-95       2750
    01-JAN-05       3000
    SCOTT@db102 SQL> set serveroutput on
    SCOTT@db102 SQL> declare
      2     v_rc    sys_refcursor;
      3     tname   varchar2(30);
      4     v_date  date;
      5     v_sal   number;
      6  begin
      7     select max(ename) into tname
      8     from emp
      9     where sal = 3000;
    10     open v_rc for 'select * from '||tname;
    11     loop
    12             fetch v_rc into v_date,v_sal;
    13             exit when v_rc%notfound;
    14             dbms_output.put_line(v_date||' '||v_sal);
    15     end loop;
    16* end;
    SCOTT@db102 SQL> /
    01-JAN-85 2500
    01-JAN-95 2750
    01-JAN-05 3000
    PL/SQL procedure successfully completed.
    SCOTT@db102 SQL>                                                                          

  • URGENT!Problem running a Query with a Subquery that includes the same table

    Hello all,
    Currently we are working over Oracle Database 10g Release 2 (10.2.0.3) Patch Set1.
    We have registered a schema called ICRI and we have created two VIEW over this schema to work in some occasions.
    CREATE OR REPLACE VIEW "ICRI_RELACIONAL_VIEW"
    (IDICRI, NOMBRERECURSO, VERSIONRECURSO) AS
    SELECT extractValue(value(i), '/ICRI/ID/text()'),
           extractValue(value(i), '/ICRI/NombreRecurso/text()'),
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()'),
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE extractValue(value(m), '/Modificacion/Secuencia/text()') =
          (SELECT max(extractValue(value(s), '/Secuencia/text()'))
           FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    WITH READ ONLY;
    CREATE OR REPLACE VIEW "ICRI_DOMINIOS_VIEW"
    (ID, DOMINIO) AS
    SELECT extractValue(value(i), '/ICRI/ID/text()'),
           extractValue(value(a), '/Dominio/text()', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"')
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Dominios/Dominio'))) a
    WITH READ ONLY;We have created 5000 XML documents based in this schema and stored in the database.
    Now we have executed different querys to obtain certain data.
    * QUERY 1
    SELECT COUNT(*) FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra'Time: 38sg. 1 row, Value: 1097.
    * QUERY 2
    SELECT COUNT(*) FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
          AND
          V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                    WHERE V2.DOMINIO = 'Tierra')Time: 34sg. 1 row, Value: 1097.
    * QUERY 3 (XPath Version)
    SELECT COUNT(*)
    FROM ICRI
    WHERE existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1
    Time: 32msg. 1 row, Value: 1097.
    * QUERY 4 (Version XPath)
    SELECT extractValue(object_value, '/ICRI/ID/text()')
    FROM ICRI
    WHERE existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1
    Time: 63mseg. 1097 rows.
    * QUERY 5
    SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra'
    Time: 15sg. 1097 rows.
    * QUERY 6
    SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
    AND
    V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
    WHERE V2.DOMINIO = 'Tierra')
    Time: 26sg. 1097 rows.
    Now, with the next query, we have found an important issue in Oracle, because this query doesn't return any row.
    * QUERY 7
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
       (extractValue(value(i), '/ICRI/ID/text()') IN
        (select extractValue(object_value, '/ICRI/ID/text()') ID
         FROM ICRI
         WHERE (existsNode(object_value, '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1)
    )Time 607mseg. 0 rows.
    * QUERY 8
    SELECT VI.IDICRI, VI.NOMBRERECURSO, VI.VERSIONRECURSO
    FROM ICRI_RELACIONAL_VIEW VI, (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
                                   WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra') V3
    WHERE VI.IDICRI = V3.ID Time: 16sg. 1097 rows.
    * QUERY 9
    SELECT VI.IDICRI, VI.NOMBRERECURSO, VI.VERSIONRECURSO
    FROM ICRI_RELACIONAL_VIEW VI
    WHERE VI.IDICRI IN
    (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
    WHERE V1.DOMINIO = 'Mar'
          AND
          V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                    WHERE V2.DOMINIO = 'Tierra')Time: 34 sg. 1097 rows.
    * QUERY 10
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
    extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
    extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m,
    (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1, ICRI_DOMINIOS_VIEW V2
    WHERE V1.ID = V2.ID AND V1.DOMINIO = 'Mar' AND V2.DOMINIO = 'Tierra') V3
    WHERE
    (extractValue(value(m), '/Modificacion/Secuencia/text()') =
    (SELECT max(extractValue(value(s), '/Secuencia/text()'))
    FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
    extractValue(value(i), '/ICRI/ID/text()') = V3.ID
    Time: 15sg. 1097 rows.
    * QUERY 11
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
    AND
       (extractValue(value(i), '/ICRI/ID/text()') IN (SELECT V1.ID FROM ICRI_DOMINIOS_VIEW V1
                                                      WHERE V1.DOMINIO = 'Mar'
                                                      AND
                                                      V1.ID IN (SELECT V2.ID FROM ICRI_DOMINIOS_VIEW V2
                                                                WHERE V2.DOMINIO = 'Tierra'))
    )Time: 30sg. 1097 rows.
    * QUERY 12
    SELECT extractValue(value(i), '/ICRI/ID/text()') ID,
           extractValue(value(i), '/ICRI/NombreRecurso/text()') NOMBRE,
           extractValue(value(i), '/ICRI/VersionRecurso/text()') || '.' || extractValue(value(m), '/Modificacion/Secuencia/text()') VERSION
    FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Modificacion'))) m
    WHERE
       (extractValue(value(m), '/Modificacion/Secuencia/text()') =
        (SELECT max(extractValue(value(s), '/Secuencia/text()'))
         FROM table(xmlsequence(extract(value(i),'/ICRI/Modificaciones/Modificacion/Secuencia'))) s)
       )Time: 187msg. 5000 rows.
    Well, if we execute the query based in a relational view all work fine but the performance of the query is hugely decreased. If we try to execute the query based in the XPath values, this options must be the correct, the query doesn't return any result.
    Any idea to solve this problem? For us it is very important to find a solution as soon as possible, because our development time is finishing.
    Our clients have installed Oracle Client 10.2.0.1 & ODAC 10.2.0.20.
    Thanks in advance for your help,
    David.

    SQL> alter session set optimizer_features_enable='10.1.0';
    Session altered.
    SQL> SELECT count(*)
    2 FROM ICRI i, table(xmlsequence(extract(value(i), '/ICRI/Modificaciones/Mo
    dificacion'))) m
    3 WHERE
    4 extractValue(value(i), '/ICRI/ID/text()') IN
    5 (select extractValue(object_value, '/ICRI/ID/text()') ID
    6 FROM ICRI
    7 WHERE (existsNode(object_value,
    8 '/ICRI/Dominios[Dominio="Mar" and Dominio="Tierra"]')=1))
    9 /
    COUNT(*)
    5
    Test this with a few of your queries and see if the results are expected.
    if so I am thinking it is close to bug 5585187
    QUERY NOT RETURNING PROPER RESULTS WITH INLINE VIEWS
    Fixed in 11.
    I am going to see if I can get an env to see if your TC works with this fix before I confirm it 100 percent.
    Also note this was done with a very scaled down version of your testcase. Using only one XML doc
    regards
    Coby
    Message was edited by: Coby
    coadams

  • Query with outer join not dispalying the correct results

    Hi All,
    I am having a table which has a column called status it can either be null or has the code which comes from the lookup b.When I use this query
    select b.menaing from a
    where a.status=b'lookup_code(+)
    AND b.lookup_type='MTH_BUSINESS_FUNCTION'
    AND b.LANGUAGE = USERENV('LANG')
    then I don't get the rows from table a, where status is null
    and if I use the condition:
    select b.menaing from a
    where ((a.status IS NULL) OR
    (a.status=b.lookup_code
    AND b.lookup_type='MTH_BUSINESS_FUNCTION'
    AND b.LANGUAGE = USERENV('LANG') ))
    then I get many extra rows.Can soemone please tell me hwo to achieve this(My query should display the menaing if status column is blank then it should dispaly blank otherwise after joining iwth the lookup table it should display meaning)

    Hi Prazy,
    using nvl also didn't solve my problem.Actually my problem is I am having a table a in which I have a column called satus, status has the values like A or I .I have one lookup called MTH_BUYSINESS_FUNCTION in which for lookup_code A I have menaing as Active and for lookup_code I meaning is Inactive.Now in table a for sttaus I have two values one A and one null Now I want to write sql which displayes the meaning for column staus.Result should be Active and null .If I am uisng 1 query which I gave u I am not able to get the 2nd row in my output.If I use 2nd query then I get duplicate rows.
    Thanks ,
    Amrit

  • Dequeue with OCCI does not remove the message from the queue

    Hey there,
    I have this problem where no matter what dequeue option I try the messages never seem to be removed from the queue... I tried looking around and found only a similar un-answered question...
    Thanks in advance...
    void TryAnydataDequeue(oracle::occi::Connection * conn)
         try
              std::cout << "Dequeue Commence..." << std::endl;
              Consumer cons(conn);
              //Settings de dequeue
              cons.setCorrelationId("SPPC");
              cons.setQueueName("Anydata_queue");
              cons.setConsumerName("SNOOP");
              cons.setDequeueMode(cons.DEQ_REMOVE);
              //cons.setDequeueMode(cons.DEQ_LOCKED);
              std::cout << "Reception du message..." << std::endl;
              Message m2 = cons.receive(Message::ANYDATA);
              AnyData any(conn);
              any = m2.getAnyData();
              if(!any.isNull())
                   oracle::occi::TypeCode type = any.getType();
                   if(type == OCCI_TYPECODE_VARCHAR2)
                        std::string msg = any.getAsString();
                        std::cout << "Message Reçu: ";
                        std::cout << msg << std::endl;
                   else
                        std::cout << "Format du message invalide..." << std::endl;
                   std::cout << "Fin du message... (Press a key)" << std::endl;
              else
                   std::cout << "Message invalide..." << std::endl;
              System::String * theInput = System::Console::ReadLine();
         catch(SQLException ex)
              std::cout << "Exception: " << ex.getErrorCode() << " - " << ex.getMessage() << std::endl;
              System::String * tnput = System::Console::ReadLine();
    }

    The message from the queue will be removed when you do a commit after a successful dequeue call, depending upon your message retention settings.
    After you have done this processing and successfully performed a commit, what is the output of the following query:
    SQL> connect AQADMIN/password
    SQL> select msg_state from aq$<your_queue_table_name_goes_here> ;?
    If it is PROCESSED, check your queue retention settings.
    Additionally, make sure that the init.ora parameter AQ_TM_PROCESSES is set to a NON-ZERO value for this to happen.

  • When I hook my ipod to computer it reads: there is a problem with this drive scan the drivenow and fit it (F) it doesnt work

    when I hook up ipod up to to itunes it reads:  IP F  There is a problem with this drive.  scan the drive now and fix it.   When I do this, nothing happens.

    Hello,
    I found the same issue. I have an iPod Classic 160 GB (Black) bought in April 2013. I'm using a Windows 8 Laptop bought in August 2014.
    This is my account of this problem and why I think customers should just ignore the pop-up, but Apple (and possibly with Microsoft/Windows) should look at the issue.
    Recently (approximately from early February 2015), when I connect the iPod to my computer I get a message saying there is a problem with the drive and it needs to be scanned and fixed. In full the message reads:
    There's a problem with this drive. Scan the drive now and fix it.
    This message appears very shortly and then immediately (once the message disappears, is clicked on, or x-d) brings up Windows File Explorer on the drive and its containing visible folders: which tells me nothing (though it can clearly open it and look at the files not locked to iTunes)
    Other than this, the iPod seems to connect properly and work fine. iTunes (ver: 12.1.0.71 64bit) seems to find no issue. The iPod runs fine, it syncs properly (all of my music and podcasts). It responds as it always has and works for hours.
    I did some troubleshooting: first on the wire, trying all ports and using an alternative, then on my laptop (all usb ports with other connectors and device drivers) and some basic testing of the iPod and iTunes. All of these seemed fine to me, no issue whatsoever other than the message every time I connect the iPod. So I just ignored it for a while.
    Anyway, eventually I got curious (and had some more free time to look at it) and let Windows 8 do what it wanted (scan and fix the drive). Clearly the iPod works fine, and I have nothing important on it that isn't on my computer, so at worst Windows will break the software and I'd have to reformat the drive through iTunes (and Restore to Factory Settings) which I feel fine doing. I also took note of all of my settings on the iPod (like EQ, and the way I laid out the menus etc...) so I can redo those from defaults.
    Prior to doing this, the iPod was version 2.0.5 (the latest version).
    When I set the drive to be scanned, windows told me it identified the problem and would fix it. I don't remember the exact wording, as this message was immediately obscured by a pop-up telling me the drive was in use and software using it should be closed. So I closed iTunes which in turn caused the pop-up and message to disappear.
    Windows then said it had succeeded and brought up the File Explorer of the drive again (now with some folders missing). When I loaded iTunes back up, it told me there was a problem with the iPod and it would need to be restored. Ejecting the iPod showed that it seemed to believe it had no content on it.
    So I restored the iPod through iTunes, downloading the latest iPod update again and started syncing the iPod. After adding a couple songs, I ejected it and played them - they worked fine, the menus had returned to defaults but I quickly changed them to how I liked and overall the iPod is back to how it was. I've now set it to sync the remaining thousands of songs (and couple hundred podcasts). Edit - by the end of this post, this has finished copying Music, Podcasts, and Playlists. It's back to exactly how it was before.
    Annoyingly, this has not removed the pop-up message when I connect the iPod, still the same as before - the most irksome thing being the file window opening every time i connect the iPod, though this is still minor (I just have to remember that this will happen and manually close it each time).
    So I'm at a loss on the cause, and am going to return to ignore it. I'd greatly appreciate if Apple could look into this. I'm wondering if it is a recent update to iTunes or to Windows, but I don't trust that I won't be able to undo changes if I myself began looking through them (and I lack the time and expertise to do that effectively). I think there might be that Windows is detecting something in the way that Apple formats their iPod drives that it believes is an issue (even when it isn't). My guess is the way of formatting is unchanged (the iPod hadn't received an update recently to suggest and alteration to this) but maybe the things Windows is looking for may have slightly changed and disagrees with Apple's way of keeping the iPod Drive proprietary to iTunes.
    TL,DR: Advice to others (and Ljchicago) searching this topic is to ignore the message for now.
    Thanks,
    Dixavd

Maybe you are looking for

  • How can I change a column to lower case?

    I selected an entire column and discovered that it's already set at Format > Font > Capitalization > None If I change "None" to "All Caps," it capitalizes everything. But when I change it back to "None," letters that were originally capitalized remai

  • In "New Tab" I see a ScreenShot of websites , but I cant see screen shot for my own site , why ?

    in My new tab , I see screenshots of my most visited Sites/Pages , but I see an empty box for my own website " http://www.oonternet.com " why ?

  • How do I update status on a discussion?

    Sorry, probably a stupid question but looked everywhere - I received 3 emails telling me to update my status and can't find it anywhere - can you please let me know how / where to change so I won't get the emails and why am I getting 3 emails? Thanks

  • Checkout view in a rule

    Hi In addition to my [previous post|http://forums.sun.com/thread.jspa?threadID=5336770&messageID=10453744#10453744], I have the following need: In a rule how can we use something like a "checkout view" ? I would like to have something like what is di

  • Enums for System.getProperty(...) method in Java API?

    Just had a thought today as a result of a colleaugue mis-spelling "file.separator" in a System.getProperty() call: How about an enum for the above method (e.g. SystemProperty) that has all the known properties and the String method for any prop not i