Retrieving Data in PL/SQL: Quiz

1.Which SQL statements can be used directly in a PL/SQL block? (Choose two.) 
*UPDATE employees SET...
* SELECT * INTO ...

2.Which one of these SQL statements can be directly included in a PL/SQL executable block?
 *INSERT INTO...;

3.Which of the following is NOT a valid guideline for retrieving data in PL/SQL?
* Do NOT use a WHERE clause in SELECT statements.

4. It is good programming practice to create identifiers having the same name as column names. True or False?

* false

 

5.Does PL/SQL allow you to have a variable with the same name as a database column?
*yes

6. When used in a PL/SQL block, which SQL statement must return exactly one row?
*SELECT

7. Look at this PL/SQL block:
DECLARE
v_count NUMBER;
BEGIN
SELECT COUNT(*) INTO v_count
FROM employees WHERE salary > 50000;
END;

No employees earn more than $50000. Which of the following statements are true? (Choose two).


 *The SELECT will return value 0 into V_COUNT
* The SELECT returns exactly one row.

8
What will happen when the following block is executed?
DECLARE
v_last employees.last_name%TYPE;
v_first employees.first_name%TYPE;
v_salary employees.salary%TYPE;
BEGIN
SELECT first_name, last_name
INTO v_first, v_last, v_salary
FROM employees WHERE employee_id=100;
END; 

* The block will fail because the SELECT is trying to read two columns into three PL/SQL variables.






    


Comments

Post a Comment