Oracle 11g对依赖的判断达到字段级
在Oracle 10g下,判断依赖性只达到了对象级,也就是说存储过程访问的对象一旦发生了变化,那么Oracle就会将存储过程置为INVALID状态。所以在为表做了DDL操作后,需要把存储过程重新进行编译。
在Oracle 11g下,对依赖的判断更加细化,判断到了字段级。虽然有这么好的特性,但我还是建议做了DDL后把存储过程再重新编译一下。
Oracle 10g下:
SQL> select * from v$version;
BANNER----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 64-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> drop table TEST purge;
SQL> drop PROCEDURE P_TEST;
SQL> CREATE TABLE TEST(ID NUMBER);
SQL> CREATE OR REPLACE PROCEDURE P_TEST AS
BEGIN
INSERT INTO TEST (ID) VALUES (100);
END;
/
SQL> col OBJECT_NAME format a10;
SQL> col OBJECT_TYPE format a10;
SQL> col STATUS format a10;
SQL> SELECT OBJECT_NAME, OBJECT_TYPE, STATUS FROM USER_OBJECTS WHERE OBJECT_NAME = ‘P_TEST‘;
OBJECT_NAM OBJECT_TYP STATUS
---------- ---------- ----------
P_TEST PROCEDURE VALID
SQL> ALTER TABLE TEST ADD (NAME VARCHAR2(30));
SQL> SELECT OBJECT_NAME, OBJECT_TYPE, STATUS FROM USER_OBJECTS WHERE OBJECT_NAME = ‘P_TEST‘;
OBJECT_NAM OBJECT_TYP STATUS
---------- ---------- ----------
P_TEST PROCEDURE INVALID
Oracle 11g下:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> drop table TEST purge;
SQL> drop PROCEDURE P_TEST;
SQL> CREATE TABLE TEST(ID NUMBER);
SQL> CREATE OR REPLACE PROCEDURE P_TEST AS
BEGIN
INSERT INTO TEST (ID) VALUES (100);
END;
/
SQL> col OBJECT_NAME format a10;
SQL> col OBJECT_TYPE format a10;
SQL> col STATUS format a10;
SQL> SELECT OBJECT_NAME, OBJECT_TYPE, STATUS FROM USER_OBJECTS WHERE OBJECT_NAME = ‘P_TEST‘;
OBJECT_NAM OBJECT_TYP STATUS
---------- ---------- ----------
P_TEST PROCEDURE VALID
SQL> ALTER TABLE TEST ADD (NAME VARCHAR2(30));
SQL> SELECT OBJECT_NAME, OBJECT_TYPE, STATUS FROM USER_OBJECTS WHERE OBJECT_NAME = ‘P_TEST‘;
OBJECT_NAM OBJECT_TYP STATUS
---------- ---------- ----------
P_TEST PROCEDURE VALID
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。