11 Managing Sub Programs
11 Managing Sub Programs
USER_OBJECTS
USER_DEPTREE
USER_PACKAGES
USER_DEPENDENCIES
Explanation:
USER_DEPENDENCIES is a data dictionary table that can be queried to view all
dependencies between all objects within a user schema.
Due to a change to a particular table, you are concerned with the number of
stored procedures and functions that may have been affected. Which table can
you query to check the status of each subprogram and determine which
procedures and functions must be recompiled?
USER_STATUS
USER_SOURCE
USER_OBJECTS
USER_CONSTRUCTS
Explanation:
The USER_OBJECTS table contains a column called STATUS. This column has two
possible values: VALID or INVALID.
For example:
Which view can you query to determine the validity of a particular procedure?
USER_STATUS
USER_SOURCE
USER_OBJECTS
USER_PROCEDURES
Explanation:
The USER_OBJECTS view contains the STATUS column that indicates the validity of each
construct. If a construct is invalid, it will be automatically recompiled upon the next
invocation.
Which data dictionary view can you query to examine all the dependencies
between the objects that you own?
USER_OBJECTS
USER_RELATIONS
USER_DEPENDENCIES
USER_RELATIONSHIPS
Explanation:
The USER_DEPENDENCIES view contains the dependencies between the objects you
own. For example, you could view all the procedures, functions, and packages that
reference the EMP table.
You have lost the script file that contains the source code for the THEATER_PCK
package. Which command will produce the source code stored in the database?
SELECT text
FROM user_source
WHERE name = 'THEATER_PCK';
SELECT text
FROM user_objects
WHERE name = 'THEATER_PCK';
SELECT text
FROM user_packages
WHERE name = 'THEATER_PCK';
SELECT text
FROM user_programs
WHERE name = 'THEATER_PCK';
Explanation:
The USER_SOURCE view contains a column called TEXT. This column contains the
source code of the particular procedure, function, or package.
The source code of database triggers are not included in this view. Instead, query the
USER_TRIGGERS view.
USER_SOURCE
USER_OBJECTS
USER_CONSTRUCTS
USER_PROCEDURES
Explanation:
The USER_SOURCE view contains a column called TEXT. This column contains the
source code of the particular procedure, function, or package.
The source code of database triggers is not included in this view. Instead, it can be obtained
by querying the USER_TRIGGERS view.
Which data dictionary view must you query to determine when a particular
procedure or function was created?
USER_SOURCE
USER_STATUS
USER_OBJECTS
USER_CONSTRUCTS
Explanation:
The USER_OBJECTS view contains a column called CREATED. This column contains the
date and time a particular construct was created.
This procedure is owned by PROD. The user JSMITH must execute this
procedure. Which command(s) must PROD execute to grant the necessary
privileges to JSMITH?
Explanation:
A user must be issued the EXECUTE privilege on the procedure. The user does not require
the DELETE privilege on the THEATER table.
If the new AUTHID CURRENT_USER directive is specified, the user would be required to
have the DELETE privilege on the THEATER table.
Explanation:
Unless you are the owner of the PL/SQL construct, you must be granted the EXECUTE
object privilege to run it or have the EXECUTE ANY PROCEDURE system privilege. By
default, a PL/SQL procedure executes under the security domain of its owner. This means
that a user can invoke the procedure without privileges on the procedures underlying
objects. If you wanted the procedure to execute under the executing owner's privileges and
not the owner, you would use the AUTHID CURRENT_USER option.
The options stating that a user needs only the RESOURCE role to execute a procedure and
if a user has the privilege to query a table and that table is referenced within a procedure,
the user can execute that procedure are incorrect. To execute a procedure, the user must
own the procedure, have been grated the EXECUTE object privilege on the procedure, or
have been granted the EXECUTE ANY PROCEDURE system privilege.
The database administrator has informed you that the CREATE PROCEDURE
privilege has been granted to your account. Which objects can you now create?
procedures only
packages and procedures only
functions and procedures only
procedures, functions, and packages
Explanation:
The CREATE PROCEDURE privilege allows a user to create procedures, functions, and
packages. There is not a separate privilege for functions and packages.
All users in the HR_EMP role have UPDATE privileges on the EMPLOYEE table.
You create the UPDATE_EMPLOYEE procedure. HR_EMP users should only
be able to update the EMPLOYEE table using this procedure. Which two
statements should you execute? (Choose two.)
Explanation:
Unless you are the owner of the PL/SQL construct, you must be granted the EXECUTE
object privilege to run it or have the EXECUTE ANY PROCEDURE system privilege. By
default, a PL/SQL procedure executes under the security domain of its owner. This means
that a user can invoke the procedure without privileges on the procedures underlying
objects. To allow HR_EMP users to execute the procedure, you must issue the GRANT
EXECUTE ON update_employee TO hr_emp; statement. To prevent HR_EMP users from
updating the EMPLOYEE table unless they are using the UPDATE_EMPLOYEE procedure,
you must issue the REVOKE UPDATE ON employee FROM hr_emp;