Oracle 11g has a field-level judgment on dependencies

Source: Internet
Author: User

Under Oracle 10g, the dependency is judged to be at the object level, which means that once the object accessed by the stored procedure has changed, Oracle will place the stored procedure in the invalid state. So after the DDL operation for the table, the stored procedure needs to be recompiled.

in Oracle 11g, the decision to rely is more granular and the field level is judged. Although there are such good features, I recommend that you do the DDL and then recompile the stored procedure.

Under 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 ());
Sql> SELECT object_name, object_type, STATUS from user_objects WHERE object_name = ' p_test ';
Object_nam Object_typSTATUS
---------- ---------- ----------
P_test PROCEDURE INVALID

under 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 ());
Sql> SELECT object_name, object_type, STATUS from user_objects WHERE object_name = ' p_test ';
Object_nam Object_typSTATUS
---------- ---------- ----------
P_test PROCEDURE VALID
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.