Which two guidelines are recommended by Oracle to reduce invalidation of dependent objects? (Choose two.)
A.
Reference tables indirectly by using views.
B.
Reference tables directly avoid using views.
C.
When adding new items to a package, add them to the end of the package.
D.
When adding new items to a package, add them to the beginning of the package.
Yes A & C. for detail visit.”Guidelines for Reducing Invalidation”
“http://docs.oracle.com/cd/B28359_01/server.111/b28318/dependencies.htm#CHDJJFAF”.
A,C
To reduce invalidation of dependent objects, follow these guidelines:
Add New Items to End of Package
Reference Each Table Through a View
The entry-point number of a procedure or function is determined by its location in the PL/SQL package code. A procedure or function added to the end of a PL/SQL package is given a new entry-point number.
Add New Items to End of Package
When adding new items to a package, add them to the end of the package. This preserves the entrypoint numbers of existing top-level package items, preventing their invalidation.
For example, consider the following package:
CREATE OR REPLACE PACKAGE pkg1 IS
FUNCTION get_var RETURN VARCHAR2;
END;
Adding an item to the end of pkg1, as follows, does not invalidate dependents that reference the get_var function:
CREATE OR REPLACE PACKAGE pkg1 IS
FUNCTION get_var RETURN VARCHAR2;
PROCEDURE set_var (v VARCHAR2);
END;
Inserting an item between the get_var function and the set_var procedure, as follows, invalidates dependents that reference the set_var function:
CREATE OR REPLACE PACKAGE pkg1 IS
FUNCTION get_var RETURN VARCHAR2;
PROCEDURE assert_var (v VARCHAR2);
PROCEDURE set_var (v VARCHAR2);
END;
Reference Each Table Through a View
Reference tables indirectly, using views. This enables you to do the following:
Add columns to the table without invalidating dependent views or dependent PL/SQL objects
Modify or delete columns not referenced by the view without invalidating dependent objects
The statement CREATE OR REPLACE VIEW does not invalidate an existing view or its dependents if the new ROWTYPE matches the old ROWTYPE.
A,C