1. Which of the following statements about the %ISOPEN cursor attribute is true?
(1) Point
Correct
2. Assume that you have declared a cursor called C_EMP. Which of the following statements about C_EMP is correct? (Choose two.)
(1) Point
Correct
3. You execute the following code:
DECLARE CURSOR emp_curs IS SELECT last_name FROM employees; v_last_name employees.last_name%TYPE; BEGIN OPEN emp_curs; LOOP -- Point A FETCH emp_curs INTO v_last_name; EXIT WHEN emp_curs%NOTFOUND; DBMS_OUTPUT.PUT_LINE(v_last_name); END LOOP; CLOSE emp_curs; END;
At Point A (after you have OPENed the cursor) another user updates an employee's last_name from 'Smith' to 'Jones' and immediately COMMITs.
When your block FETCHes this row, which value will be fetched and displayed?
(1) Point
Incorrect. Refer to Section 5 Lesson 1.
4. One (and only one) employee has LAST_NAME = 'Grant'. You need to code: SELECT ... FROM employees WHERE last_name = 'Grant';
Which type of cursor should you use, and why?
(1) Point
Incorrect. Refer to Section 5 Lesson 1.
5. You cannot OPEN or CLOSE an implicit cursor. Why not?
(1) Point
Correct
6. Which one of the following statements is NOT true?
(1) Point
Correct
7. Examine the following code:
DECLARE CURSOR region_cur IS SELECT * FROM wf_world_regions; v_region_rec region_cur%ROWTYPE; CURSOR country_cur (p_region_id NUMBER) IS SELECT * FROM wf_countries WHERE region_id = p_region_id; v_country_rec country_cur%ROWTYPE; BEGIN OPEN region_cur; LOOP FETCH region_cur INTO v_region_rec; EXIT WHEN region_cur%NOTFOUND; DBMS_OUTPUT.PUT_LINE (v_region_rec.region_name); -- Line A -- LOOP FETCH country_cur INTO v_country_rec; EXIT WHEN country_cur%NOTFOUND; ......
What would you code at Line A?
(1) Point
Incorrect. Refer to Section 5 Lesson 6.
8. What is wrong with the following code?
DECLARE CURSOR emp_curs(p_dept_id NUMBER) IS SELECT * FROM employees WHERE department_id = p_dept_id; BEGIN FOR dept_rec IN (SELECT * FROM departments) LOOP DBMS_OUTPUT.PUT_LINE(dept_rec.department_name); FOR emp_rec IN emp_curs(dept_rec.department_id) LOOP DBMS_OUTPUT.PUT_LINE(emp_rec.last_name); END LOOP; END LOOP; END;
(1) Point
Incorrect. Refer to Section 5 Lesson 6.
9. There are 12 distinct JOB_IDs in the EMPLOYEES table. You need to write some PL/SQL code to fetch and display all the employees with a specific JOB_ID. The chosen JOB_ID can be different each time the code is executed. What is the best way to do this?
(1) Point
Incorrect. Refer to Section 5 Lesson 4.
10. Look at the following code:
DECLARE CURSOR emp_curs (p_dept_id employees.department_id%TYPE) IS SELECT * FROM employees WHERE department_id = p_dept_id; v_emp_rec emp_curs%ROWTYPE; v_deptid NUMBER(4) := 50; BEGIN OPEN emp_curs( -- Point A --); ....
You want to open the cursor, passing value 50 to the parameter. Which of the following are correct at Point A?
(1) Point
11. What is wrong with the following code?
DECLARE CURSOR dept_curs IS SELECT * FROM departments; BEGIN FOR dept_rec IN dept_curs LOOP DBMS_OUTPUT.PUT_LINE(dept_curs%ROWCOUNT || dept_rec.department_name): END LOOP; DBMS_OUTPUT.PUT_LINE(dept_rec.department_id); END;
(1) Point
Correct
12. A cursor FOR loop using a subquery can shorten code length when compared to an explicit cursor declaration. True or False?
(1) Point
Correct
13. What is the difference between the following two blocks of code?
--Block A DECLARE CURSOR emp_cursor IS SELECT employee_id, last_name FROM employees WHERE department_id = 80 FOR UPDATE OF salary;
--Block B DECLARE CURSOR emp_cursor IS SELECT employee_id, last_name FROM employees WHERE department_id = 80 FOR UPDATE OF salary NOWAIT;
(1) Point
Incorrect. Refer to Section 5 Lesson 5.
14. You have declared a cursor as SELECT .... FOR UPDATE; You have OPENed the cursor and locked the FETCHed rows. When are these row locks released?
(1) Point
Incorrect. Refer to Section 5 Lesson 5.
15. When can we use the WHERE CURRENT OF clause?
(1) Point
1. The employees table contains 11 columns. The following block declares a cursor and a record based on the cursor:
DECLARE CURSOR emp_curs IS SELECT * FROM employees; v_emp_rec emp_curs%ROWTYPE;
A twelfth column is now added to the employees table. Which of the following statements is true?
(1) Point
Incorrect. Refer to Section 5 Lesson 2.
2. You can reference explicit cursor attributes directly in a SQL statement. True or False?
(1) Point
Incorrect. Refer to Section 5 Lesson 2.
3. What is missing from the following cursor declaration?
CURSOR emp_curs IS SELECT * FROM departments WHERE location_id = p_loc_id;
(1) Point
Correct
4. A cursor has been declared as: CURSOR c_curs (p_param VARCHAR2) IS SELECT * FROM mytable WHERE mycolumn = p_param; Which of the following will open the cursor successfully?
(1) Point
Correct
5. Which statement correctly places the employee id and last name into the stated variables?
DECLARE CURSOR emp_cursor IS SELECT employee_id, last_name FROM employees WHERE department_id = 30; v_empno employees.employee_id%TYPE; v_lname employees.last_name%TYPE; BEGIN OPEN emp_cursor; -- Point A ...
1. Which command would you use to see if your triggers are enabled or disabled? Tandai untuk Ditinjau (1) Point SELECT trigger_name, status FROM USER_TRIGGERS; (*) SELECT trigger_name, trigger_type FROM USER_TRIGGERS; SELECT object_name, status FROM USER_OBJECTS WHERE object_type = 'TRIGGER'; DESCRIBE TRIGGER Incorrect. Refer to Section 13 Lesson 5. 2. After the following SQL statement is executed, all the triggers on the DEPARTMENTS table will no longer fire, but will remain in the database. True or False? ALTER TABLE departments DISABLE ALL TRIGGERS; Tandai untuk Ditinjau (1) Point True (*) False Correct 3. A user creates the following trigger: CREATE OR REPLACE TRIGGER emp_trigg AFTER DELETE ON employees BEGIN ... END; The user now tries to drop the EMPLOYEES table. What happens? Tandai untuk Ditinjau (1) Point Both the table and the trigger are dropped. (*) The table is dropped and the trigger is disabled. The ...
1. Which of the following statements will show whether procedure myproc is valid or invalid? Tandai untuk Ditinjau (1) Point SELECT * FROM deptree; SELECT status FROM USER_PROCEDURES WHERE procedure_name = 'MYPROC'; SELECT status FROM USER_OBJECTS WHERE object_type = 'PROCEDURE' AND object_name = 'MYPROC'; (*) SELECT valid FROM USER_OBJECTS WHERE object_type = 'PROCEDURE' AND object_name = 'MYPROC'; Incorrect. Refer to Section 14 Lesson 1. 2. A single procedure can be both a referenced object and a dependent object. True or False? Tandai untuk Ditinjau (1) Point True (*) False Correct 3. A single PL/SQL subprogram such as a procedure can be both a referenced object and a dependent object. True or False? Tandai untuk Ditinjau (1) Point True (*) False Correct 4. View dept_view is based on a select from table departments. Procedure show_dept contains code which selects from dept_view. Which of the following statements are true? (C...
Komentar
Posting Komentar