zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    点击鼠标获得坐标位置
    广告的字一个一个的显示出来
    纯css实现下拉菜单的效果
    用css3写出的倒三角形
    MySQL(三)
    Navicat之MySQL连接(二)
    MySQL 的安装与使用(一)
    Servlet(二)
    Servlet(一)
    Linux常用命令大全
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/5057099.html
Copyright © 2011-2022 走看看