首页 > 代码库 > Oracle 11g对依赖的判断达到字段级
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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。