Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is indeed strange issue, thanks for sharing!</p> <p>It really looks like a behavior change in Oracle starting with Oracle 11.1 and there is even confirmed bug with similar issue on metalink (bug#10425196). Unfortunately at the moment there is no much information available on metalink on subject mater, but I've also opened SR with Oracle asking to provide more information.</p> <p>While at the moment I can not provide you an explanation why it happens and if there is a (hidden) parameter that can reverse this behavior back to 10g style, I think I can provide you with workaround. You can use Oracle flashback query functionality to force Oracle to retrieve data as to expected point in time. </p> <p>If you change your code as follows:</p> <pre><code>OPEN crs FOR SELECT col1 &gt;&gt;&gt; FROM vw1 as of scn dbms_flashback.get_system_change_number WHERE col1 = 'TEST1'; </code></pre> <p>then result should be the same as in 10g.</p> <p>And this is simplified version of original test case:</p> <pre><code>SQL&gt; drop table tbl1; Table dropped SQL&gt; create table tbl1(col1 varchar2(10), col2 number); Table created SQL&gt; create unique index tbl1_idx on tbl1(col1); Index created SQL&gt; insert into tbl1(col1,col2) values('TEST1',0); 1 row inserted SQL&gt; DECLARE 2 cursor web_cursor is 3 SELECT col1 4 FROM tbl1 5 WHERE col2 = 0 and col1 = 'TEST1'; 6 7 rec1 web_cursor%rowtype; 8 BEGIN 9 OPEN web_cursor; 10 11 UPDATE tbl1 12 SET col2 = 1 13 WHERE col1 = 'TEST1'; 14 15 -- different result depending on commit! 16 commit; 17 18 DBMS_OUTPUT.PUT_LINE('Start'); 19 LOOP 20 FETCH web_cursor 21 INTO rec1; 22 23 EXIT WHEN web_cursor%NOTFOUND; 24 25 DBMS_OUTPUT.PUT_LINE(rec1.col1); 26 END LOOP; 27 DBMS_OUTPUT.PUT_LINE('Finish'); 28 END; 29 / Start Finish PL/SQL procedure successfully completed </code></pre> <p>If you comment out commit on line 16 than the output will be:</p> <pre><code>Start TEST1 Finish PL/SQL procedure successfully completed </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload