CREATE OR REPLACE PROCEDURE insert_emps IS TYPE t_emp IS TABLE OF employees%ROWTYPE INDEX BY BINARY_INTEGER; v_emptab t_emp; BEGIN FORALL i IN v_emptab.FIRST..v_emptab.LAST INSERT INTO employees VALUES v_emptab(i); END LOOP; END insert_emps;
(1) Point
Correct
2. Which of the following are NOT benefits of using the NOCOPY hint? (Choose two)
(1) Point
Incorrect. Refer to Section 12 Lesson 2.
3. You want to take make a copy of all the cities in the world listed in the cities table, which contains millions of rows. The following procedure accomplishes this efficiently. True or False?
CREATE OR REPLACE PROCEDURE copy_cities IS TYPE t_cities IS TABLE OF cities%ROWTYPE INDEX BY BINARY_INTEGER; v_citiestab t_emp; BEGIN SELECT * BULK COLLECT INTO v_citiestab FROM cities; FORALL i IN v_citiestab.FIRST..v_citiestab.LAST INSERT INTO new_cities VALUES v_citiestab(i); END copy_cities;
(1) Point
Correct
4. In the following example, where do you place the phrase DETERMINISTIC?
CREATE OR REPLACE FUNCTION total_sal (p_dept_id IN -- Position A employees.department_id%TYPE) RETURN NUMBER -- Position B IS v_total_sal NUMBER; BEGIN SELECT SUM(salary) INTO v_total_sal FROM employees WHERE department_id = p_dept_in; RETURN v_total_sal -- Position C; END total_sal;
(1) Point
Correct
5. What is the correct syntax to use the RETURNING phrase at Position A?
DECLARE TYPE EmpRec IS RECORD (last_name employees.last_name%TYPE, salary employees.salary%TYPE); emp_info EmpRec; emp_id NUMBER := 100; BEGIN UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id -- Position A dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' || emp_info.salary); END;
(1) Point
1. The following statement is a valid example of using the RETURNING clause. True or False?
DECLARE TYPE EmpRec IS RECORD (last_name employees.last_name%TYPE, salary employees.salary%TYPE); emp_info EmpRec; emp_id NUMBER := 100; BEGIN UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id; RETURNING last_name, salary INTO emp_info; dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' || emp_info.salary); END;
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
2. You want to take make a copy of all the cities in the world listed in the cities table, which contains millions of rows. The following procedure accomplishes this efficiently. True or False?
CREATE OR REPLACE PROCEDURE copy_cities IS TYPE t_cities IS TABLE OF cities%ROWTYPE INDEX BY BINARY_INTEGER; v_citiestab t_emp; BEGIN SELECT * BULK COLLECT INTO v_citiestab FROM cities; FORALL i IN v_citiestab.FIRST..v_citiestab.LAST INSERT INTO new_cities VALUES v_citiestab(i); END copy_cities;
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
3. A function-based index may be made using your own functions, but only if the function is created using the DETERMINISTIC clause. True or False?
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
4. What does the RETURNING clause do in the example below?
CREATE OR REPLACE PROCEDURE new_dept (p_dept_name IN departments.name%TYPE) IS v_new_dept_id departments.dept_id%TYPE; BEGIN INSERT INTO departments (dept_id, name) VALUES dept_seq.NEXTVAL, p_dept_name RETURNING dept_seq.CURRVAL INTO v_new_dept_id; DBMS_OUTPUT.PUT_LINE(p_dept_name ||' is department number ' || v_new_dept_id); END new_dept;
Tandai untuk Ditinjau
(1) Point
Inserts the new department id in the department table
Uses the new department number in a cursor
Performs the SELECT statement to determine the department id of the new department (*)
Incorrect. Refer to Section 12 Lesson 2.
5. FORALL can only be used with the INSERT statement. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
6. The following example code will compile successfully. True or False?
CREATE OR REPLACE PROCEDURE dept_proc IS TYPE t_dept IS TABLE OF departments%ROWTYPE INDEX BY BINARY_INTEGER; BEGIN (p_small_arg IN NUMBER, p_big_arg OUT NOCOPY t_dept); -- remaining code END dept_proc;
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
7. The following procedure compiles successfully. True or False?
CREATE OR REPLACE PACKAGE emp_pkg IS TYPE t_emp IS TABLE OF employees%ROWTYPE INDEX BY BINARY_INTEGER; PROCEDURE emp_proc (p_small_arg IN NUMBER, p_big_arg NOCOPY OUT t_emp); ... END emp_pkg;
Tandai untuk Ditinjau
(1) Point
True
False (*)
Incorrect. Refer to Section 12 Lesson 2.
8. In the following example, where do you place the phrase BULK COLLECT?
... BEGIN SELECT -- Position A salary -- Position B INTO v_saltab -- Position C FROM employees WHERE department_id = 20 ORDER BY salary -- Position D ; ...
Tandai untuk Ditinjau
(1) Point
Position A
Position B (*)
Position C
Position D
Correct
9. The DBMS_SQL package is easier to use than EXECUTE IMMEDIATE. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
Incorrect. Refer to Section 12 Lesson 1.
10. A public packaged procedure contains the following SQL statement: UPDATE employees SET salary = salary * 1.1; When is this SQL statement parsed?
Tandai untuk Ditinjau
(1) Point
When the package header is loaded into memory
When the package body is created (*)
When the package is loaded into memory
Only the first time the procedure is executed
When the package specification is created
11. What happens when a SQL statement is parsed? (Choose three.)
Tandai untuk Ditinjau
(1) Point
The user's required privileges are checked.(*)
The syntax of the statement is checked.(*)
The results of the statement are returned to the user.
The statement is executed.
Oracle queries the Data Dictionary to make sure that the tables referenced in the SQL statement exist.(*)
Incorrect. Refer to Section 12 Lesson 1.
12. A SQL statement can pass through several stages. Which of the following is NOT one of these stages?
Tandai untuk Ditinjau
(1) Point
EXECUTE
RETURN (*)
BIND
PARSE
FETCH
Incorrect. Refer to Section 12 Lesson 1.
13. What will happen when the following procedure is invoked?
CREATE OR REPLACE PROCEDURE do_some_work IS CURSOR c_curs IS SELECT object_name FROM user_objects WHERE object_type = 'FUNCTION'; BEGIN FOR v_curs_rec IN c_curs LOOP EXECUTE IMMEDIATE 'ALTER FUNCTION ' || v_curs_rec.object_name || ' COMPILE'; EXIT WHEN c_curs%ROWCOUNT > 2; END LOOP; END;
Tandai untuk Ditinjau
(1) Point
The first three functions in the user's schema will be recompiled. (*)
The first two functions in the user's schema will be recompiled.
The procedure will not compile successfully because you cannot ALTER functions using Dynamic SQL.
All functions in the user's schema will be recompiled.
The procedure will not compile successfully because the syntax of the ALTER FUNCTION statement is incorrect.
Correct
14. The following procedure adds a column of datatype DATE to the EMPLOYEES table. The name of the new column is passed to the procedure as a parameter.
CREATE OR REPLACE PROCEDURE addcol (p_col_name IN VARCHAR2) IS v_first_string VARCHAR2(100) := 'ALTER TABLE EMPLOYEES ADD ('; v_second_string VARCHAR2(6) := ' DATE)'; BEGIN ... Line A END;
Which of the following will work correctly when coded at line A? (Choose two.)
15. Only one call to DBMS_SQL is needed in order to drop a table. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
1. The following statement is a valid example of using the RETURNING clause. True or False?
DECLARE TYPE EmpRec IS RECORD (last_name employees.last_name%TYPE, salary employees.salary%TYPE); emp_info EmpRec; emp_id NUMBER := 100; BEGIN UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id; RETURNING last_name, salary INTO emp_info; dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' || emp_info.salary); END;
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
2. In the following example, where do you place the phrase BULK COLLECT?
DECLARE TYPE NameList IS TABLE OF emp.ename%TYPE; names NameList; CURSOR c1 IS SELECT ename -- Position A FROM emp WHERE job = 'CLERK'; BEGIN OPEN c1; FETCH c1 -- Position B INTO -- Position C names; ... CLOSE c1; END;
Tandai untuk Ditinjau
(1) Point
Position A
Position B (*)
Position C
Incorrect. Refer to Section 12 Lesson 2.
3. In the following example, where do you place the phrase DETERMINISTIC?
CREATE OR REPLACE FUNCTION total_sal (p_dept_id IN -- Position A employees.department_id%TYPE) RETURN NUMBER -- Position B IS v_total_sal NUMBER; BEGIN SELECT SUM(salary) INTO v_total_sal FROM employees WHERE department_id = p_dept_in; RETURN v_total_sal -- Position C; END total_sal;
Tandai untuk Ditinjau
(1) Point
Position A
Position B (*)
Position C
Incorrect. Refer to Section 12 Lesson 2.
4. Where would you place the BULK COLLECT statement in the following example?
DECLARE TYPE DeptRecTab IS TABLE OF departments%ROWTYPE; dept_recs DeptRecTab; CURSOR c1 IS SELECT department_id, department_name, manager_id, location_id -- Position A FROM departments WHERE department_id > 70; BEGIN OPEN c1 -- Position B; FETCH c1 -- Position C INTO dept_recs; END;
Tandai untuk Ditinjau
(1) Point
Position A
Position B
Position C (*)
Incorrect. Refer to Section 12 Lesson 2.
5. You want to take make a copy of all the cities in the world listed in the cities table, which contains millions of rows. The following procedure accomplishes this efficiently. True or False?
CREATE OR REPLACE PROCEDURE copy_cities IS TYPE t_cities IS TABLE OF cities%ROWTYPE INDEX BY BINARY_INTEGER; v_citiestab t_emp; BEGIN SELECT * BULK COLLECT INTO v_citiestab FROM cities; FORALL i IN v_citiestab.FIRST..v_citiestab.LAST INSERT INTO new_cities VALUES v_citiestab(i); END copy_cities;
Tandai untuk Ditinjau
(1) Point
True (*)
False
6. FORALL can only be used with the INSERT statement. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
Incorrect. Refer to Section 12 Lesson 2.
7. A function-based index may be made using your own functions, but only if the function is created using the DETERMINISTIC clause. True or False?
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
8. The following example code will compile successfully. True or False?
CREATE OR REPLACE PROCEDURE dept_proc IS TYPE t_dept IS TABLE OF departments%ROWTYPE INDEX BY BINARY_INTEGER; BEGIN (p_small_arg IN NUMBER, p_big_arg OUT NOCOPY t_dept); -- remaining code END dept_proc;
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
9. Dynamic SQL enables data-definition, data-control, or session-control statements to be written and executed from PL/SQL.
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
10. Which of the following SQL statements can be included in a PL/SQL block only by using Dynamic SQL? (Choose two.)
Tandai untuk Ditinjau
(1) Point
ALTER(*)
DELETE
SELECT ..... FOR UPDATE NOWAIT
SAVEPOINT
GRANT(*)
11. When SQL statements are included within a procedure, the statements are parsed when the procedure is compiled. True or False?
Tandai untuk Ditinjau
(1) Point
True (*)
False
Correct
12. For which of the following is it necessary to use Dynamic SQL? (Choose three.)
Tandai untuk Ditinjau
(1) Point
ALTER(*)
UPDATE
GRANT(*)
SAVEPOINT
DROP(*)
Incorrect. Refer to Section 12 Lesson 1.
13. The DBMS_SQL package is easier to use than EXECUTE IMMEDIATE. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
Incorrect. Refer to Section 12 Lesson 1.
14. Only one call to DBMS_SQL is needed in order to drop a table. True or False?
Tandai untuk Ditinjau
(1) Point
True
False (*)
Incorrect. Refer to Section 12 Lesson 1.
15. A public packaged procedure contains the following SQL statement: UPDATE employees SET salary = salary * 1.1; When is this SQL statement parsed?
1. You can define variables and assign values to them using PLSQL_CCFLAGS. Then test the values of the variables using inquiry directives. True or False? Tandai untuk Ditinjau (1) Point True (*) False Correct 2. How would you determine the current Oracle database version? Tandai untuk Ditinjau (1) Point DBMS_DB_VERSION.VERSION (*) DBMS_DB_VERSION.RELEASE DBMS_DB_VERSION.VER_LE_11 DBMS_DB_VERSION.VER_LE_10 Correct 3. Identify the selection directives used in conditional compilation. Tandai untuk Ditinjau (1) Point $$IF $$THEN $$ELSE $$ELSIF $$END $IF $THEN $ELSE $ELSIF $END (*) $IF $THEN $ELSE $END $CCFLAG $IF $THEN $ELSE $ELSIF $ENDIF $$IF $$THEN $$ELSE $$END $$DEBUG Incorrect. Refer to Section 15 Lesson 3. 4. Conditional compilation allows you to include extra code to help with debugging, which can be removed once errors are resolved. True or False? Tandai untuk Ditinjau (1) Point True (*) False Correct 5. O...
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 ...
Komentar
Posting Komentar