Section 9
Section 9
Section 9
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
1. You try to create a function named MYFUNC. The function does not compile
correctly because there are errors in your code. Which Dictionary view can you query to see the
errors? Mark for Review
(1) Points
USER_SOURCE
USER_COMPILES
USER_ERRORS (*)
USER_DEPENDENCIES
USER_OBJECTS
Correct Correct
2. You have created a function named NEWFUNC. You now change some of the
function code, and try to recreate the function by executing:
What happens?
(1) Points
The command fails because you should execute: CREATE AND REPLACE ....;
Correct Correct
B Write the code containing the CREATE or REPLACE FUNCTION followed by the function code
(1) Points
A,B,E,F,D,C
B,C,E,F,D,A
D,B,E,F,A,C
B,E,F,D,A,C (*)
Correct Correct
(1) Points
Correct Correct
5. You want to create a function which can be used in a SQL statement. Which
one of the following can be coded within your function? Mark for Review
(1) Points
COMMIT;
An OUT parameter
RETURN BOOLEAN
Correct Correct
Section 9 Quiz
FROM employees;
(1) Points
The data type for the tax variable does not match the data type for salary.
(1) Points
Definer's Rights are the default, therefore no extra code or commands are needed. (*)
Correct Correct
8. What will happen when the following procedure is executed?
IS
PRAGMA AUTONOMOUS_TRANSACTION
BEGIN
COMMIT;
END log_usage;
(1) Points
The subprogram will fail because it is missing AUTHID CURRENT_USER before IS.
The subprogram will fail because the PRAGMA statement must be before IS.
Correct Correct
9. What is one of the main purposes of the Data Dictionary? Mark for
Review
(1) Points
To provide a list of all objects in your schema, but not in other users' schemas
None of these.
We can use it like a Web search engine to remind ourselves of the names of dictionary
views.
Section 9 Quiz
11. Which of the following will tell you how many functions you own?
Mark for Review
(1) Points
(1) Points
True (*)
False
Correct Correct
13. JOE's schema contains a COUNTRIES table. The following commands are
executed by JOE and TOM:
(1) Points
DICK also loses his SELECT privilege. (*)
The REVOKE statement fails because only the Database Administrator (not JOE) can revoke
privileges.
Nothing. DICK's privilege is preserved even though TOM lost his privilege.
The REVOKE statement fails because JOE must remove the SELECT privilege from both users
at the same time.
14. Which view would you query to see the detailed code of a procedure?
Mark for Review
(1) Points
user_dependencies
user_procedures
user_errors
user_objects
user_source (*)
BEGIN
EXCEPTION
END;
When call_ins_emp is executed, (assuming Auto Commit is turned on), which rows will be inserted
into the EMPLOYEES table?
Mark for Review
(1) Points
999 only
99 and 999
99 only (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
1. User DIANE owns a DEPARTMENTS table. User JOEL needs to update the
location_id column of Diane's table, but no other columns. Which SQL statement should Diane
execute to allow this? Mark for Review
(1) Points
2. You granted user JOE the privilege to query the EMPLOYEES table in your
schema. Now, you want to remove this privilege from JOE. Which command would you use?
Mark for Review
(1) Points
ROLLBACK;
(1) Points
DBMS_OUTPUT.PUT_LINE(get_job(100));
v_job_id := get_job(100);
get_job(100,v_job_id); (*)
(1) Points
True
False (*)
(sal employees.salary%type,
comm_pct IN employees.commission%type)
...
(1) Points
Begin
...
Ann_comp := annual_comp(1000,.2);
...
End;
from employees;
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
(1) Points
AUTHID CURRENT_USER IS
BEGIN ...
(*)
BEGIN
AUTHID CURRENT_USER
BEGIN ...
BEGIN ...
Correct Correct
(1) Points
The user who executes the procedure needs EXECUTE privilege on the procedure. (*)
The user who executes the procedure does not need any privileges.
The user who executes the procedure needs SELECT privilege on EMPLOYEES. (*)
(1) Points
SELECT index_name
FROM user_indexes
(1) Points
fn_index FN_INDEX
FN_INDEX
fn_index
Correct Correct
10. User JOHN wants to see the names of all the tables in his schema. He does
NOT want to see the names of any tables in other users' schemas. Which Dictionary view should he
query? Mark for Review
(1) Points
DICTIONARY
ALL_TABLES
DBA_TABLES
JOHN_TABLES
USER_TABLES (*)
Section 9 Quiz
11. You want to remove the procedure NO_NEED from your schema. You
execute:
(1) Points
None of these
USER_SOURCE
USER_OBJECTS
USER_PROCEDURES
Incorrect Incorrect. Refer to Section 9 Lesson 4.
BEGIN
EXCEPTION
END;
When call_ins_emp is executed, (assuming Auto Commit is turned on), which rows will be inserted
into the EMPLOYEES table?
(1) Points
99 only (*)
All three rows will be inserted
99 and 999
999 only
13. Which of the following is a legal location for a function call in a SQL
statement? (Choose 3) Mark for Review
(1) Points
(1) Points
Correct Correct
(1) Points
They can do the same job as built-in system functions such as UPPER and ROUND.
They can add business rules to the database and can be reused many times. (*)
They can be used in a WHERE clause to filter data and thereby increase efficiency. (*)
Incorrect Incorrect. Refer to Section 9 Lesson 2.
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
1. You have forgotten the name of the Dictionary view USER_TABLES. Which of
the following statements is the best and quickest way to remind yourself? Mark for Review
(1) Points
(*)
2. Which of the following is NOT a benefit of the Data Dictionary? Mark for
Review
(1) Points
It allows the PL/SQL compiler to check for object existence; for example, when creating a
procedure which references a table, the PL/SQL compiler can check that the table exists.
It allows us to remind ourselves of the names of our tables, in case we have fogotten them.
It allows us to check which system privileges have been granted to us.
It will speed up the execution of SELECT statements in which the WHERE clause column is
not indexed. (*)
3. You want to display the names of all tables in your schema, but you have
forgotten which Dictionary view to query. Which of the following will remind you of the name of the
correct Dictionary view? Mark for Review
(1) Points
SELECT *
FROM USER_OBJECTS
HELP DICTIONARY
SELECT *
FROM DICTIONARY
(*)
SELECT *
FROM DICTIONARY
SELECT *
FROM DICTIONARY
BEGIN
EXCEPTION
When call_ins_emp is executed, (assuming Auto Commit is turned on), which rows will be inserted
into the EMPLOYEES table?
(1) Points
99 and 999
99 only (*)
999 only
IS BEGIN
child1;
child2;
END parent;
What happens?
(1) Points
CHILD2 is dropped successfully. PARENT and CHILD1 are both marked INVALID.
CHILD2 is dropped successfully. PARENT is marked INVALID, but CHILD1 is still valid. (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
6. User SALLY's schema contains a NEWEMP table. Sally uses Invoker's rights to
create procedure GET_NEWEMP which includes the line:
Sally also grants EXECUTE privilege on the procedure to CURLY, but no other privileges. What will
happen when Curly executes the procedure?
(1) Points
The procedure will fail because Curly does not have the EXECUTE ANY PROCEDURE system
privilege.
The procedure will fail because Curly does not have SELECT privilege on NEWEMP.
The procedure will fail because there is no NEWEMP table in Curly's schema. (*)
7. How do you specify that you want a procedure MYPROCA to use Invoker's
Rights? Mark for Review
(1) Points
(*)
(1) Points
IN parameters
Local variables in the IS/AS section
An exception section
Correct Correct
9. You have created a function named NEWFUNC. You now change some of the
function code, and try to recreate the function by executing:
What happens?
(1) Points
The command fails because you should execute: CREATE AND REPLACE ....;
10. A function must have at least one IN parameter, and must return exactly
one value. Mark for Review
(1) Points
True
False (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 9 Quiz
11. You have created a function called USEFUL. You want every database user to
be able to invoke the function. Which command would you use to do this? Mark for Review
(1) Points
12. JOE's schema contains a COUNTRIES table. The following commands are
executed by JOE and TOM:
(1) Points
Nothing. DICK's privilege is preserved even though TOM lost his privilege.
The REVOKE statement fails because JOE must remove the SELECT privilege from both users
at the same time.
The REVOKE statement fails because only the Database Administrator (not JOE) can revoke
privileges.
Correct Correct
FROM employees;
(1) Points
The data type for the tax variable does not match the data type for salary.
(1) Points
True (*)
False
Correct Correct
15. You want to create a function which can be used in a SQL statement. Which
one of the following can be coded within your function? Mark for Review
(1) Points
An OUT parameter
RETURN BOOLEAN
COMMIT;