Tuesday, November 27, 2007

ora_rowscn and oracle 11.1.0.6.0/Linux

Symptom: code does not compile when using ora_rowscn in joins.
Sulution: Download the patch .6168363 by Metalink and install it as described in the readme file
More:

REDISCOVERY INFORMATION:
If you see a dump in phf_copy_to_diana and the PL/SQL unit being compiled
contains a SQL statement as described in the problem description and
simple test case.
@
WORKAROUND:
Change the order of the tables in the join so the pseudo column or built in
is called on the first table in the join.
@
RELEASE NOTES:
]]Compilation of PL/SQL units with SQL statements that involve joins and
]]references to pseudo columns or zero argument built in functions may
]]fail in some circumstances.

A patch 6168363 has been created for Linux x86
Patch 6168363 is also available for Linux x86_64

Code to test this:
If procedure compiles OK then the patch is applied/not needed
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DROP TABLE c1;
DROP TABLE l1;
CREATE TABLE c1 (r1 VARCHAR2(11));
CREATE TABLE l1 (r1 VARCHAR2(11));
INSERT INTO c1 VALUES('ABC');
INSERT INTO l1 VALUES('ABC');
COMMIT;

CREATE OR REPLACE PROCEDURE TEST_SCN IS
v_scn NUMBER;
v_r1 VARCHAR2(11);
BEGIN

SELECT l1.ora_rowscn
INTO v_scn
FROM
c1,
l1
WHERE c1.r1 = l1.r1
AND c1.r1 ='ABC';
END TEST_SCN;
/

0 comments: