Sie sind auf Seite 1von 6

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
GRANT UPDATE ON departments.location_id TO joel;
GRANT UPDATE ON departments(location_id) TO joel;
GRANT UPDATE ON departments TO joel;
GRANT UPDATE ON location_id OF departments TO joel;
GRANT UPDATE(location_id) ON departments TO joel; (*)
Correct

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
DENY SELECT ON employees TO joe;
ROLLBACK;
GRANT UNSELECT ON employees TO joe;
UNGRANT SELECT ON employees TO joe;
REVOKE SELECT ON employees FROM joe; (*)
Correct

3. To create a function successfully, the following steps should be


performed.
A   Re-execute the code until it compiles correctly
B   Write the code containing the CREATE or REPLACE FUNCTION followed by
the function code
C   Test the function from a SQL statement or an anonymous block
D   If the function fails to compile, correct the errors
E   Load the code into Application Express
F   Execute the code in Application Express

What is the correct order to perform these steps?

Mark for Review


(1) Points
B,C,E,F,D,A
B,E,F,D,A,C (*)
A,B,E,F,D,C
D,B,E,F,A,C
Correct

4. A function named MYFUNC has been created. This function accepts one IN
parameter of datatype VARCHAR2 and returns a NUMBER.
You want to invoke the function within the following anonymous block:
DECLARE
v_var1 NUMBER(6,2);
BEGIN
-- Line A
END;
What could be coded at Liine A?

Mark for Review

(1) Points
myfunc('Crocodile', v_var1);
v_var1 := myfunc('Crocodile'); (*)
myfunc(v_var1, 'Crocodile');
myfunc(v_var1) := 'Crocodile';
myfunc('Crocodile') := v_var1;
Correct

5. Examine the following code:


CREATE OR REPLACE FUNCTION add_func
(p_param1 NUMBER, p_param2 NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN (p_param1 + p_param2);
END;
What will be displayed when the following SQL statement is executed?
SELECT add_func(6, add_func(3,8)) FROM dual;

Mark for Review

(1) Points
An error message will be displayed because you cannot nest user-defined
functions.
11
23
17 (*)
66
Correct
6. You want to see the names, modes, and data types of the formal
parameters of function MY_FUNC in your schema. How can you do this?
(Choose two)
Mark for Review

(1) Points
Query USER_SOURCE (*)
SHOW PARAMETER my_func;
DESCRIBE my_func; (*)
Query USER_PARAMETERS
Query USER_FUNCTIONS
Correct

7. Which view would you query to see the detailed code of a procedure?
Mark for Review

(1) Points
user_objects
user_dependencies
user_errors
user_source (*)
user_procedures
Correct

8. 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
To ensure correct spelling of the values in VARCHAR2 table columns
To translate data from one language to another
To prevent users from accidentally dropping tables
To provide a structured list of all objects in the database (*)
Correct

9. Which of the following statements about the "super-view" DICTIONARY is


true?
Mark for Review

(1) Points
All of these. (*)
It lists all the dictionary views.
It can be thought of as a "catalog of the master catalog".
None of these.
We can use it like a Web search engine to remind ourselves of the names of
dictionary views.
Correct

10. You want to find out how many Dictionary views will list objects in your
schema (but not in other users' schemas). Which of the following queries
should you use to do this?
Mark for Review

(1) Points
SELECT COUNT(*)
    FROM USER_DICTIONARY;
SELECT COUNT(*)
    FROM DBA_OBJECTS
    WHERE OWNER='USER';
SELECT COUNT(*)
    FROM DICTIONARY
    WHERE TABLE_NAME NOT LIKE 'DBA%';
SELECT COUNT(*)
    FROM DICTIONARY;
SELECT COUNT(*)
    FROM DICTIONARY
    WHERE TABLE_NAME LIKE 'USER%'; (*)
Correct
Previous
11. Which statement is true regarding the following subprogram?
PROCEDURE at_proc IS
 PRAGMA AUTONOMOUS_TRANSACTION;
 dept_id NUMBER := 90;
 BEGIN
   UPDATE ...
   INSERT ...
 END at_proc;

Mark for Review

(1) Points
The subprogram's success is independent of the calling program. (*)
The subprogram cannot do a COMMIT.
The subprogram's success depends on the calling program.
The subprogram will fail because the RETURN is not specified.
Correct

12. How do you specify that you want a procedure MYPROCA to use


Invoker's Rights?
Mark for Review

(1) Points
ALTER PROCEDURE myproca TO INVOKER;
GRANT INVOKER TO myprocA;
CREATE OR REPLACE PROCEDURE myproca
AUTHID OWNER IS...
CREATE OR REPLACE PROCEDURE myproca
AUTHID CURRENT_USER IS... (*)
Invoker's Rights are the default, therefore no extra code is needed.
Correct

13. 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;
One or more IN parameters (*)
RETURN BOOLEAN
An OUT parameter
Correct

14. The following function has been created:


CREATE OR REPLACE FUNCTION upd_dept
    (p_dept_id IN departments.department_id%TYPE)
    RETURN NUMBER IS
BEGIN
    UPDATE departments
    SET department_name = 'Accounting'
       WHERE department_id = p_dept_id;
    RETURN p_dept_id;
END;

Which of the following will execute successfully?

Mark for Review

(1) Points
SELECT upd_dept(80)
FROM dual;
DELETE FROM employees
WHERE department_id = upd_dept(80); (*)
SELECT upd_dept(department_id)
FROM employees;
DELETE FROM departments
WHERE department_id = upd_dept(department_id);
Correct

15. User-defined functions can extend the power of SQL statements where


Oracle does not provide ready-made functions such as UPPER and LOWER.
True or False?
Mark for Review

(1) Points
True (*)
False
Correct
Previous

Das könnte Ihnen auch gefallen