Is there a change in the way 10g sees the rowid column.

i have two databases in my test environment
1. Oracle 10g on CentOS 5.3
2. Oracle 9i on Windows Server 2003
i am practicing simple SQL with the default HR schema created while creating databases using dbca.
all i am doing is trying to display the employee with the 10th highest salary.
in Oracle 10g i run the following command:
SQL> select first_name || ' ' || last_name, salary from employees where
rowid =
(select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum <=10
minus
select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum < 10);
FIRST_NAME||''||LAST_NAME                          SALARY
Lisa Ozer                                           11500when i run the same command in 9i
select first_name || ' ' || last_name, salary from employees where
rowid =
(select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum <=10
minus
select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum < 10)
no rows selectedon digging deeper i found out that in 9i .... when i run the two sub-queries, give the same rowid as output.
SQL> select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum <=10;
ROWID
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
10 rows selected.
SQL> select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum < 10;
ROWID
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
AAAHM7AAFAAAABXAAI
9 rows selected.the same two queries in 10g give different rowids (this is correct)
SQL> select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum <=10;
ROWID
AAAMg3AAFAAAABYAAA
AAAMg3AAFAAAABYAAB
AAAMg3AAFAAAABYAAC
AAAMg3AAFAAAABYAAt
AAAMg3AAFAAAABYAAu
AAAMg3AAFAAAABUAAD
AAAMg3AAFAAAABUAAH
AAAMg3AAFAAAABYAAI
AAAMg3AAFAAAABYAAv
AAAMg3AAFAAAABYABE
10 rows selected.
SQL> select rowid from (select first_name || ' ' || last_name from employees order by salary desc) where rownum < 10;
ROWID
AAAMg3AAFAAAABYAAA
AAAMg3AAFAAAABYAAB
AAAMg3AAFAAAABYAAC
AAAMg3AAFAAAABYAAt
AAAMg3AAFAAAABYAAu
AAAMg3AAFAAAABUAAD
AAAMg3AAFAAAABUAAH
AAAMg3AAFAAAABYAAI
AAAMg3AAFAAAABYAAv
9 rows selected.is there a change in the way Oracle 10g treats rowids from subqueries?
when i change the query to include the rowid in the innermost sub-query things work as they should in both 10g and 9i
select first_name || ' ' || last_name, salary from employees where
rowid =
(select rowid from (select rowid,first_name || ' ' || last_name from employees order by salary desc) where rownum <=10
minus
select rowid from (select rowid,first_name || ' ' || last_name from employees order by salary desc) where rownum < 10)

OK,
I didn't seem to have made myself clear. You state
'the above query uses rownum to filter the top 10 and top 9 salaries and picks the person with the 10th highest salary.'
As you are using row*id* , and rowids are random strings, and can change during the life of your table, you can not rely on the results of your query.
Your usage of the rownum pseudo function (as opposed to the rownum analytical function is also incorrect, as rownum is assigned prior to ordering it.
This
        select * from
         (select rownum rn, ename, sal
          from
          (select ename, sal from scott.emp order by sal desc)
          where rn=10is quite as sufficient, and doesn't use hacks like rowid.
Sybrand Bakker
Senior Oracle DBA
Experts: those who did read documentation.

Similar Messages

  • Are there significant changes in the UI framework between 5.2 and 2007 ?

    Hi,
    As the UI framework got introduced in 5.2 . Are there significant changes to the framework between 5.2 and 2007.
    Therefore could a developer with experience in 5.2 carry out developments within the UI framework for 2007?
    These developments need to be carried out to integrate a third party solution .
    Regards
    Manbir

    Hi Manbir,
    have worked with 5.1 and 5.2 before switching to 6.0.
    I did not notice many changes in the framwork. Most of it still seems to be ICWC anyway.
    - SAP has added some new BAdI's,
    - there seems to be a lot of additional logic regarding webservices
    - there are some new UI gimmicks (Move Assignmentblocks, Configuriation directly in the client, sortable tableviews, etc.)
    - the designlayer (did not notice it before)
    - component enhancements (I believe they were there in 5.2)
    - editable overviewpages, i.e. extensive use of the view_group_context
    So yes, when you have done 5.2 before, you will know your way aroung most things and be better off then 90% of the people starting with 6.0

  • HT6058 Is there any change in the MODERN FIRMWARE??

    Is there any change in the MODERN FIRMWARE with the new ios update of 7.0.4?

    The entire point of an update is to make changes in the current firmware.
    So, yes there are changes.  That is what an update is.

  • Is there any changes in the DIAdem script between DIAdem 9.x and DIAdem 10.x ?

    Hello,
    I have got a question about DIAdem Script.
    I saw the compatibility problem described in KB.
    'Why do my DIAdem 9.1 Scripts not work in DIAdem 10?'
    Many problems were solved, but some case were not.
    So I guess there is some changes in the DIAdem script between DIAdem 9.x and DIAdem 10.x
    Thanks for your help.

    Hi supportko...
    Yes, there were a lot of new features introduced in DIAdem 10.0, and 10.1.  These are described in detail in each product's ReadMe file, and also in the Online Help under  the "Index" tab at the node "DIAdem>>New Features>>New Commands and Variables"-- you will see 2 sections there:  "Version 10.1", and "Version 10.0", showing you exactly what has changed.  In most cases there is a compatability switch whenever a new feature creates a compatability issue for scripts developed in a previous DIAdem version.  R&D works very hard to minimize the impact of new features on existing VBScript applications.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Message Edited by Support on 05-02-2007 03:56 PM

  • Is there any change in the constant pool entires with JDK1.4?

    Hi,
    Here is my simple java class,
    class Base
    String manuf = "MRF";
    class Derived extends Base
    Derived() {
    manuf = "ABC";
    After compiling this class with JDK 1.3 and JDK1.4, i could see the difference in constant pool entries
    so please let me know more about these cahnges.
    P.S. : written a java program TClass.java to browse the constant pool entries.
    i.e if compiled with JDK1.3 , constant pool entries looks as follows,
    E:\bugs\jdk1.4\pramila>java TClass E:\bugs\jdk1.4\pramila\Derived.class
    There are 21 + 1 entries in the Constant Pool:
    Index Tag Reference(s)/Value(s)
    1 10 5 15
    2 8 16
    3 9 5 17
    4 7 18
    5 7 19
    6 1 <init>
    7 1 ()V
    8 1 Code
    9 1 LineNumberTable
    10 1 LocalVariableTable
    11 1 this
    12 1 LDerived;
    13 1 SourceFile
    14 1 Test.java
    15 12 6 7
    16 1 ABC
    17 12 20 21
    18 1 Derived
    19 1 Base
    20 1 manuf
    21 1 Ljava/lang/String;
    There are 1 methods:
    Code array in method <init> of length 11 starting at byte 231.
    If compiled with JDK1.4 constant pool entries looks as follows,
    E:\bugs\jdk1.4\pramila>java TClass E:\bugs\jdk1.4\pramila\Derived.class
    There are 21 + 1 entries in the Constant Pool:
    Index Tag Reference(s)/Value(s)
    1 10 5 15
    2 8 16
    3 9 4 17
    4 7 18
    5 7 19
    6 1 <init>
    7 1 ()V
    8 1 Code
    9 1 LineNumberTable
    10 1 LocalVariableTable
    11 1 this
    12 1 LDerived;
    13 1 SourceFile
    14 1 Test.java
    15 12 6 7
    16 1 ABC
    17 12 20 21
    18 1 Derived
    19 1 Base
    20 1 manuf
    21 1 Ljava/lang/String;
    There are 1 methods:
    Code array in method <init> of length 11 starting at byte 231.
    There is a change in the index 3 can be noticed.
    i.e
    with JDK1.3 it is "3 9 5 17"
    with JDK1.4 it is "3 9 4 17"
    Thanks in advance.
    Pramila

    javac v1.4 emits by default Java 1.2 compatible .class files while all javac implementations since between 1.1.0 and 1.3.1 emit byte default Java 1.1 .class files.
    Check to see what effect using the -target option in javac to get the two versions to produce Java 1.1, 1.2, or 1.3 .class files.
    Chuck

  • Is there a change in the blur function?

    I'v noticed a change in the way blur works in Aperture.  It doesn't blur as much.  In fact, it whitens more than in blurs.  Has anyone else noticed this as well?

    Nevermind, I didn't adjust the "strength" of the brush high enough.

  • Cmp bean - change to the database column not accepting

    Hi,
    I have a CMP Entity bean defined within the application. I had to change the column size of one of the table defined database. It was changed for 1 character to 3. But while inserting the records through the application the EJB still seems to consider the column with 1 character and not 3. I'm not sure if there is something to be changed in the weblogic-cmp-rdbms-jar.xml file. Can someone tell me if I have to change something, so that the entity bean recognizes the column size as 3 and not as 1 ?
    thank you very much in advance.
    -Harish

    here is the rdbms-bean.jar.xml setting for the particular table. i do not think there is any special settings like dbms-column-type.
    <weblogic-rdbms-bean>
    <ejb-name>OrderItem</ejb-name>
    <data-source-name>Order.DataSource</data-source-name>
    <table-map>
    <table-name>ORDER_ITEM</table-name>
    <field-map>
    <cmp-field>itemId</cmp-field>
    <dbms-column>item_id</dbms-column>
    </field-map>
    <field-map>
    <cmp-field>lenderPoolCode</cmp-field>
    <dbms-column>lender_pool_code</dbms-column>
    </field-map>
    </table-map>
    <weblogic-query>

  • Is there a change in the way Firefox 4 displays fonts from CSS?

    This site is coded using standard CSS and had Arial Narrow as first font choice for certain elements. In Firefox 4 / Windows 7 those instances are now defaulting to secondary font - Arial or to the default font Times Roman. EVERY other browser including past Firefox have displayed Arial Narrow properly - assuming the user has it in their system fonts - which is the vast majority of visitors. NEED a fix for this!

    This worked for me:
    font-family: Arial;
    font-stretch: condensed;

  • Was there a change to the location where iTunes copies media with the "Keep media folder organized" option selected?

    iTunes was copying my media to for example:
    \volume\iTunes\Music\Artist\Album\tracks.mp3
    \volume\iTunes\Movies\Movie\movie.mp4
    \volume\iTunes\TV Shows\TV Show\Season\episode.mp4
    I believe after the update it started to copy and move files to different locations:
    \volume\iTunes\Artist\Album\tracks.mp3
    \volume\iTunes\Movies\movie.mp4
    \volume\iTunes\TV Shows\TV Show\episode.mp4
    Music is no longer being copied to the Music folder, it's being copied or moved to the root of where I have my iTunes directory defined.  Has anyone seen this change happen to them?

    Actually to get it to run through your library as it now exists I think the consolidate command is still around (I don't have itunes 10).
    How to Consolidate Your iTunes Library and Keep It Organized - http://www.switched.com/2010/11/02/itunes-consolidate-library-keep-organized/

  • Change in the ePrint sharing options?

    Hi, has there been changes in the  HP ePrint over-the-air sharing options lately? I'm trying to print out a picture on a webpage from my smartphone, but the I get an error message saying that I can't print out from browser, but I need to print out jpegs? Thanks for your help!

    Have you tried sending the picture via email as an attachment?  Are you can try using the Hp ePrint mobile app.
    Hp ePrint app
    Let me know how it goes.

  • Change in the AD Server (OAM)

    Hi All,
    I have successfully installed Identity and Access System and able to login to Access manager and policy domian.
    now the AD is moved to the other server i.e the IP of the AD which I was using is being changed. Now I am unable to login to the Access sytem.Can anyone tell me wat config changes should I make if there is change in the ip of the AD.
    Thanks in Advance.

    You will need to reconfigure your Identity Server and Policy Manager to point to the new IP address. If Access Server has been installed, then that also needs to be reconfigured with the new IP address of the AD. To reconfigure the components you can make use with the utilities provided for reconfiguration in the "tools" directory.
    Else following approach can be used :
    In order to change the AD server IP in the identity server configuration files, run the setup of Identity Server. Follow the below steps to reconfigure Identity Server:
    1. Stop Identity Server
    2. Take a backup of the existing /identity/oblix/config folder
    3. Copy the contents of ois_server_config.xml.bak to ois_server_config.xml
    4. Rename/remove configInfo.xml
    5. Rename/remove setup.xml
    6. Remove/rename oblix/config/ldap folder
    7. Start the identity server
    8. Start the webpass web server
    Access /identity/oblix and click on Identity System Console, you will be prompted to go through setup screen. Here you can provide the new IP address of the AD server.
    Same steps can be followed to reconfigure the Policy Manager.
    -Amol

  • How to get the rowid and the entire record selected in PLSQL?

    The code given below does not work.
    You cannot select the record and the rowid using a cursor in one-shot.
    But you could do that in a direct SELECT in "SQL Plus" when you select records for display. Is this a bug in ORACLE PLSQL? Or is there another way to do this?
    DECLARE
    objid_ VARCHAR2(200);
    rec_ xxx_tab%ROWTYPE;
    CURSOR get_rec IS
    SELECT t.*, t.rowid
    FROM xxx_tab t;
    BEGIN
    OPEN get_rec;
    FETCH get_rec INTO rec_, objid_;
    CLOSE get_rec;
    END;
    -----------------------------------

    You cannot fetch into both a record type and a variable. You have a few options, you can declare the record a s a rowtype of the cursor like this:
    DECLARE
       CURSOR c IS
          SELECT t.*, rowid rid
          FROM t;
       l_rec c%ROWTYPE;
    BEGIN
       OPEN c;
       FETCH c INTO l_rec;
       CLOSE c;
    END;You could use an implicit cursor and let Oracle deal with the record type internally (not to mention the open fetch and close) like this:
    BEGIN
       FOR rec in (SELECT t.*, rowid rid FROM t) LOOP
          do_stuff with rec.col_name
       END LOOP;
    END;Note that in both of these you must alias the rowid column to some other name, you could also manually construct the record type to match the table and add a column od ROWID datatype to hold the rowid.
    Finally, I think, depending on what you are actually going to do with the rowid, and how you feel about having records locked, you could look at declaring the cursor as FOR UPDATE and get rhe rowid for free.. This would be most appropriate if you are planning to update the table in the cursor (a bad practce by the way). Something like:
    DECLARE
       l_rec t%ROWTYPE;
       CURSOR c IS
          SELECT t.*, rowid
          FROM t;
    BEGIN
       OPEN c;
       FETCH c INTO l_rec;
       do_whatever with l_rec
       UPDATE t
       SET whatever
       WHERE current of c;
    END;John

  • Why isn't my SharePoint online document library showing anything in the Title column for PDFs I upload?

    I've got a document library on my SharePoint Online site. I've enabled the Title column in the library view. When I upload Word documents, the title I entered into the document properties list (Word 2010, File > Info > Properties list > Title) appears
    in the Title column of my library in SharePoint. But when I upload the published PDF version (created from the same Word file using Word 2010 by File > Save As) to the library, there's nothing in the Title column. Why? Is SharePoint failing to read the
    metadata of the PDF file? Is Word 2010 failing to copy the metadata into the PDF file when it's created from the Word file?
    What's going wrong and how do I fix it?
    When answering, please keep in mind that I'm a SharePoint novice.
    Regards,
    Bruce Officer

    I think I've ruled out the possibility that Word isn't saving the Title property with the PDF when I convert to PDF using Word 2010's built-in Save As PDF command. I found a utility called Evermap AutoMetadata which shows all the metadata saved in a PDF
    file and the Title field is indeed present in the PDF, with the correct value. Windows File Explorer won't show that property as present, but AutoMetadata does. It now looks like SharePoint isn't reading that field for some reason. Does anyone know why, and
    what I should do about it?

  • Is there a way to make a number of cells add to a certain number. I need 5 or 6 cells to add to 1700. If one of the cells becomes 0, I need the other cells to change so the bottom number stays at 1700.

    is there a way to make a number of cells add to a certain number. I need 5 or 6 cells to add to 1700. If one of the cells becomes 0, I need the other cells to change so the bottom number stays at 1700.

    Okay then. If your seven numbers are in column B then the formula next to each number in column C would be
    =IF(B=0,0,1700/COUNTIF(B,">0"))
    This assumes all non-zero numbers are positive numbers. The sum will be 1700.

  • Is there a way to remove the changes to the URL Bar, specifically the status information and the target URL?

    To begin, I utterly despise the changes to the URL Bar and the removal of the Status bar. In order to stay with the latest version of Firefox I am attempting to recreate the look and feel as best I can.
    I have already installed the Status-4-Evar extension. The only thing that remains is to remove the status information and the target URL from the bar.
    Are there any settings in about:config that will allow me to make these changes?
    EDIT: Status information can be removed by toggling. status4evar.statusInUrlBar. Still looking for a way to remove the target URL...

    This code in [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line seems to remove the links that appear on hover.
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    .urlbar-textbox-container {color: inherit !important;}
    .urlbar-textbox-container-children {opacity: 1 !important;}
    .urlbar-over-link-box {opacity: 0 !important;}
    </nowiki></pre>
    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files

Maybe you are looking for

  • IPhoto & iMovie update not available with this Apple ID

    Hi everyone - I'm at a loss as to how to fix this issue... I'm trying to update iPhoto and iMovie from the Mac App Store but I get the following error message: Update unavailable with this Apple ID: This update is not available for this Apple ID eith

  • Import Excel gives Java error

    When I try to import an excel spreadsheet, I get the following error: org.apache.poi.hssf.record.RecordFormatException: Unable to construct record instance, the following exception occured: null      at org.apache.poi.hssf.record.RecordFactory.create

  • Convert character sets for one or more characters

    Hello, Issue: Source File: Test.csv Source file dropped on application server as csv file via FTP Total records in csv file 102396 while loading into PSA  I can able to load only 38,000 records after that I am getting error message " convert characte

  • Installation of update KB2977320 results in error code 29569 and 45671

    When trying to manually install the update KB2977320 after the automatic installation failed I get the following entries in my log: 2014-11-20 17:10:47 Slp: Sco: Attempting to normalize directory path 'c:\Program Files\Microsoft SQL Server\100\Shared

  • Gray thumbnails and can't drag and drop clips

    I've been using iMovie 11 for a while now, and have accumulated more footage than my Mac HD can hold, so I migrated all my iMovie Events to an external HD. Everything still worked fine for several days after I moved the videos, but then a few days la