PL/SQL Section 10 Quiz

 1. Examine the following code:

CREATE OR REPLACE PACKAGE emppack IS
    PROCEDURE upd_emp (p_empno IN NUMBER, p_salary IN NUMBER);
END emppack;
CREATE OR REPLACE PACKAGE BODY emppack IS
    -- Line A
    PROCEDURE upd_emp (p_empno IN NUMBER, p_salary IN NUMBER) IS
       BEGIN
          IF NOT sal_ok(p_salary) THEN
             RAISE_APPLICATION_ERROR(-20201,'Invalid salary');
          END IF;
    END upd_emp;
    FUNCTION sal_ok(pf_salary NUMBER) RETURN BOOLEAN IS
       BEGIN
          IF pf_salary > 50000 THEN RETURN FALSE;
          ELSE RETURN TRUE;
          END IF;
    END sal_ok;
END emppack;

What must be coded at Line A for this package to compile successfully?


(1) Point

2. Examine the following package code:

CREATE OR REPLACE PACKAGE ol_pack IS
    PROCEDURE subprog (p1 IN VARCHAR2, p2 IN NUMBER);
    PROCEDURE subprog (param1 IN CHAR, param2 IN NUMBER);
    FUNCTION subprog (param1 IN VARCHAR2, param2 IN NUMBER) RETURN DATE;
END ol_pack;

Which of the following calls will be successful? (Choose two.)


(1) Point

3. The following call to the function tax in the taxes_pkg package is invalid for what reason?

SELECT taxes_pkg.tax(salary), salary, last_name
FROM   employees;

(1) Point

4. The following example package specification is valid to create a data type ed_type that can be used in other subprograms. True or False?

CREATE OR REPLACE PACKAGE emp_dept_pkg
IS
 TYPE ed_type IS RECORD (f_name employees.first_name%TYPE,
                                                 l_name employees.last_name%TYPE,
                                                 d_name departments.department_name%TYPE);
 PROCEDURE sel_emp_dept
  (p_emp_id IN employees.employee_id%TYPE,
   p_emp_dept_rec OUT ed_type);
END emp_dept_pkg;


(1) Point

5. INDEX BY is missing from the emp_tab TYPE declaration. What is the most efficient declaration?

CREATE OR REPLACE PACKAGE emp_pkg IS
 TYPE emp_tab IS TABLE OF employees%ROWTYPE;
 PROCEDURE get_employees(p_emp_table OUT emp_tab);
END emp_pkg;


(1) Point

1. Every subprogram which has been declared in a package specification must also be included in the package body. Triue or False?


(1) Point

2. In which component of a package is the full definition of a public procedure written?

(1) Point

3. Package EMP_PACK contains two procedures, DEL_EMP and SHOW_EMP. You want to write an anonymous block which invokes these procedures but you have forgotten which parameters they use. Which of the following will give you this information?

(1) Point

4. Package MYPACK contains procedure MYPROC. You can see which parameters MYPROC uses by executing: DESCRIBE mypack.myproc. True or False?

(1) Point

5. The following package specification has been created:

CREATE OR REPLACE PACKAGE mypack IS
    FUNCTION myfunc(p_funcparam DATE) RETURN BOOLEAN;
    PROCEDURE myproc(p_procparam IN NUMBER);
END mypack;

Which of the following will correctly invoke the package subprograms? (Choose two.)


(1) Point

Komentar

Postingan populer dari blog ini

PL/SQL Section 15 Quiz

PL/SQL Section 13 Quiz

PL/SQL Section 14 Quiz