Final Semester 1 PLSQL
Final Semester 1 PLSQL
How can you retrieve the error code and error message of any Oracle Server
exception?
By using the functions SQLCODE and SQLERRM (*)
By using the functions SQLCODE and SQLERR
By using RAISE_APPLICATION_ERROR
By defining an EXCEPTION variable and using PRAGMA EXCEPTION_INIT
2. Which of these exceptions would need to be raised explicitly by the PL/SQL
programmer?
OTHERS
A SELECT statement returns more than one row.
A check constraint is violated.
A SQL UPDATE statement does not update any rows. (*)
A row is FETCHed from a cursor while the cursor is closed.
3. Examine the followiing code. Which exception handlers would
successfully trap the exception which will be raised when this code is
executed? (Choose two.)
DECLARE
CURSOR emp_curs IS SELECT * FROM employees;
v_emp_rec emp_curs%ROWTYPE;
BEGIN
FETCH emp_curs INTO v_emp_rec;
OPEN emp_curs;
CLOSE emp_curs;
EXCEPTION ...
END;
WHEN CURSOR_NOT_OPEN
WHEN INVALID_CURSOR (*)
WHEN OTHERS (*)
WHEN NO_DATA_FOUND
WHEN INVALID_FETCH
4. Which of the following are examples of predefined Oracle Server errors? (Choose
three.) (Choose all correct answers)
TOO_MANY_ROWS (*)
NO_DATA_FOUND (*)
OTHERS
ZERO_DIVIDE (*)
E_INSERT_EXCEP
5. An attempt to insert a null value into a NOT NULL table column raises
an ORA-01400 exception. How can you code an exception handler to trap
this exception?
Test for WHEN ORA-1400 in the exception section.
Declare a variable e_null_excep of type EXCEPTION, associate it with ORA-01400
using a PRAGMA
directive, and test for WHEN e_null_excep in the exception section. (*)
Declare a variable e_null_excep of type VARCHAR2, associate it with ORA-01400
using a PRAGMA
directive, and test for WHEN e_null_excep in the exception section.
Declare a variable as follows: e_null_excep EXCEPTION := -01400; Then test for
WHEN e_null_excep in the exception section.
EXCEPTION
WHEN NO_DATA_FOUND THEN statement_1;
WHEN NO_DATA_FOUND THEN statement_2;
WHEN OTHERS THEN statement_3;
END;
EXCEPTION
WHEN OTHERS THEN statement_1;
END; (*)
8. While a PL/SQL block is executing, more than one exception can occur at the
same time. True or False?
True
False (*)
9. Which of the following best describes a PL/SQL exception?
A user enters an invalid password while trying to log on to the database.
An error occurs during execution which disrupts the
normal operation of the program. (*)
A DML statement does not modify any rows.
The programmer makes a spelling mistake while writiing the PL/SQL code.
EXCEPTION
WHEN NO_DATA_FOUND OR TOO_MANY_ROWS
THEN statement_1;
statement_2;
WHEN OTHERS
THEN statement_3;
END;
True (*)
False
11. Department-id 99 does not exist. What will be displayed when the following
code is executed?
DECLARE
v_deptname departments.department_name%TYPE;
BEGIN
SELECT department_name INTO v_deptname
FROM departments WHERE department_id = 99;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20201,'Department does not exist');
END;
True
False (*)
13. There are no employees in department 99. What message or messages will be
displayed when the following code is executed?
DECLARE
e_my_excep EXCEPTION;
BEGIN
BEGIN
UPDATE employees SET salary = 10000
WHERE department_id = 99;
IF SQL%ROWCOUNT = 0 THEN
RAISE e_my_excep;
END IF;
EXCEPTION
WHEN e_my_excep THEN
DBMS_OUTPUT.PUT_LINE('Message 1');
RAISE e_my_excep;
DBMS_OUTPUT.PUT_LINE('Message 2');
END;
DBMS_OUTPUT.PUT_LINE('Message 3');
EXCEPTION
WHEN e_my_excep THEN
DBMS_OUTPUT.PUT_LINE('Message 4');
END;
Message 1
Message 3
Message 1
Message 2
Message 1
Message 3
Message 4
Message 1
Message 4 (*)
True (*)
False
15. What will happen when the following code is executed?
DECLARE
e_excep1 EXCEPTION;
e_excep2 EXCEPTION;
BEGIN
RAISE e_excep1;
EXCEPTION
WHEN e_excep1 THEN BEGIN
RAISE e_excep2; END;
END;
It will fail to compile because you cannot have a subblock inside an exception
section.
It will fail to compile because e_excep1 is out of scope in the subblock.
It will fail to compile because you cannot declare more than one exception in the
same block.
It will compile successfully and return an unhandled e_excep2 to the calling
environment. (*)
The code will fail because you cannot declare a cursor in an inner block.
The code will fail because the cursor is declared in the inner block but is referenced
in the outer block. (*)
The code will execute successfully and display all the employees' salaries.
The code will execute forever because there is no statement to EXIT from the loop.
The code will fail to compile because e_inner_excep cannot be referenced in the
outer block. (*)
The code will propagate the e_outer_excep back to the calling environment.
The code will execute successfully and 'Outer Raised' will be displayed.
The code will fail to compile because e_inner_excep was declared but never RAISEd.
18. Examine the following code which shows three levels of nested block. What is
the scope of the variable v_middle_var?
DECLARE --outer block
v_outer_var NUMBER;
BEGIN
DECLARE --middle block
v_middle_var NUMBER;
BEGIN
DECLARE --inner block
v_inner_var NUMBER;
BEGIN
...
END;
END;
END;
True
False (*)
20. Examine the following code. What is the scope and visibility of the outer block's
v_last_name?
DECLARE
v_last_name VARCHAR2(20);
BEGIN
DECLARE
v_last_name VARCHAR2(20);
BEGIN
...
END:
...
END;
21. Which of the following statements about actual parameters is NOT true?
22. Which of the following can NOT be used as the datatype of a procedure
parameter?
A non-SQL datatype such as BOOLEAN
The name of another procedure (*)
A large object datatype such as CLOB
A PLSQL record defined using %ROWTYPE A PLSQL record defined using %ROWTYPE
23. Which of the following best describes how an IN parameter affects a procedure?
It describes the order in which the procedure's statements should be executed.
It describes which parts of the procedure's code are optional or conditional.
It makes the procedure execute faster.
It passes a value into the procedure when the procedure is invoked. (*)
It allows complex calculations to be executed inside the procedure.
24. You have created procedure MYPROC with a single parameter PARM1
NUMBER. Now you want to add a second parameter to the procedure. Which
of the following will change the procedure successfully?
25. Which of the following is NOT correct coding for a procedure parameter?
(p_param IN VARCHAR2)
(p_param VARCHAR2)
(p_param VARCHAR2(50)) (*)
(p_param employees.last_name%TYPE)
(p_param IN OUT VARCHAR2)
SOMEPROC(10,20,D=>50);
How was parameter D referenced? How was parameter D referenced?
Positionally
Named (*)
A combination of positionally and named
A combination of named and defaulted
Defaulted
Positional (*)
Named
A combination of positionally and named
A combination of named and defaulted
Defaulted
29. What are the type of parameter modes?
CHARACTER, NUMBER, DATE, BOOLEAN
myproc(40);
myproc(10, B => 30, 50);
myproc(C => 25);
All of the above
None of the above (*)
END (*)
32. Which of the following are characteristics of PL/SQL stored procedures? (Choose
three.) (Choose all correct answers)
They are named PL/SQL blocks (*)
They must return exactly one value to the calling environment.
They can have an exception section. (*)
They can be invoked from inside a SQL statement.
They can accept parameters. (*)
EXECUTE my_proc1;
BEGIN
my_proc1;
END; (*)
A only
A and B
A and C
A, B and C (*)
B and C
35. A PL/SQL stored procedure can accept one or more input parameters
and can return one or more output values to the calling environment.
True or False?
True (*)
False
Twice
Four times
None (*)
Eight times
Once
23
11
66
17 (*)
An error message will be displayed because you cannot nest user-defined functions.
38. You have created a function named NEWFUNC. You now change some of
the function code, and try to recreate the function by executing:
CREATE OR REPLACE FUNCTION newfunc .... ;
What happens?
The command fails because the function already exists.
The function is automatically dropped and then recreated. (*)
The command fails because you should execute: CREATE AND REPLACE ....;
A second function named NEWFUNC_2 is created.
The function is dropped but not recreated.
41. A function must have at least one IN parameter, and must return exactly one
value.
True
False (*)
43. User REYHAN creates the following procedure: CREATE PROCEDURE proc1
AUTHID CURRENT_USER IS v_count NUMBER; BEGIN SELECT COUNT(*)
INTO v_count FROM tom.employees; END; User BILL wants to execute this
procedure.
What privileges will BILL need?
EXECUTE on REYHAN.PROC1 and SELECT on TOM.EMPLOYEES (*)
EXECUTE on REYHAN.PROC1 SELECT on TOM.EMPLOYEES
BILL needs no privileges
None of the above. The procedure will fail to compile because REYHAN does not
have SELECT privilege on TOM.EMPLOYEES.
44. How do you specify that you want a procedure MYPROCA to use Invoker's
Rights?
45. Which of the following are NOT allowed in a function which is used
inside a SQL statement which updates the EMPLOYEES table? (Choose two).
(Choose all correct answers)
SELECT .... FROM departments ....;
COMMIT; (*)
A RETURN statement.
DDL statements such as CREATE or ALTER. (*)
A WHEN OTHERS exception handler.
46. Which one of the following statements about user-defined functions is NOT true?
They can execute spell-checking routines.
They can be used inside SQL statements.
They can be combined (nested) together, similar to nesting system functions, for
example INITCAP(SUBSTR( .....)).
They can return a TIMESTAMP datatype.
They can allow you to COMMIT from inside a SELECT statement. (*)
48. Which Data Dictionary view can be used to display the detailed code of a
procedure in your schema?
USER_PROCEDURES
USER_OBJECTS
USER_SOURCE (*)
USER_SUBPROGRAMS
None of the above.
49. 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) (Choose all correct answers)
Query USER_PARAMETERS
Query USER_SOURCE (*)
Query USER_FUNCTIONS
SHOW PARAMETER my_funct;
DESCRIBE my_funct; (*)
50. The following code shows the dependencies between three procedures:
CREATE PROCEDURE parent
IS BEGIN
child1;
child2;
END parent;
You now try to execute:
DROP PROCEDURE child2;
What happens?
True (*)
False
It will fail to compile because you cannot have a subblock inside an exception
section.
It will fail to compile because e_excep1 is out of scope in the subblock.
It will fail to compile because you cannot declare more than one exception in the
same block.
It will compile successfully and return an unhandled e_excep2 to the calling
environment. (*)
10
20 (*)
30
40
200
True
False (*)
Section 7
11. Which of the following best describes a predefined Oracle Server error? (1)
Points
Has a standard Oracle error number but must be named by the PL/SQL
programmer
Is not raised automatically but must be declared and raised explicitly by the
PL/SQL programmer
Has a standard Oracle error number and a standard name which can be
referenced in the EXCEPTION section (*)
Is associated with an Oracle error number using PRAGMA EXCEPTION_INIT
True
False (*)
13. Examine the following code. What message or messages will be displayed when
this code is executed?
DECLARE
v_last_name employees.last_name%TYPE;
v_number NUMBER := 27;
BEGIN
v_number := v_number / 0;
SELECT last_name INTO v_last_name FROM employees
WHERE employee_id = 999;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No rows were found');
WHEN ZERO_DIVIDE THEN
DBMS_OUTPUT.PUT_LINE('Attempt to divide by zero');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('An error occurred');
END;
(1) Points
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(-02290,e_sal_excep);
DECLARE
PRAGMA EXCEPTION_INIT(e_sal_excep,-02290);
e_sal_excep EXCEPTION;
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(e_sal_excep,-02290); (*)
DECLARE
e_sal_excep EXCEPTION;
PRAGMA_EXCEPTION_INIT(e_sal_exception,-02290);
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(e_sal_excep,02290);
True (*)
False
True
False (*)
18. Department-id 99 does not exist. What will be displayed when the following
code is executed?
DECLARE
v_deptname departments.department_name%TYPE;
BEGIN
SELECT department_name INTO v_deptname
FROM departments WHERE department_id = 99;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20201,'Department does not exist');
END;
(1) Points
ORA-01403: No Data Found ORA-20201: Department does not exist
ORA-01403: No Data Found
ORA-20201: Department does not exist (*)
None of the above
Section 8
BEGIN
SELECT double_it(20)
FROM DUAL;
END;
DECLARE
v_result NUMBER(6);
BEGIN
v_result := double_it(20);
END;
DECLARE
v_result NUMBER(6) := 20;
BEGIN
double_it(v_result);
END; (*)
BEGIN
double_it(20);
END;
21. Which of the following best describes how an IN parameter affects a procedure?
(1) Points
myproc(5,10,20);
myproc(a=>5,b=>10,20) (*)
myproc(a=>5,b=>10,c=>20)
myproc(5,10,c=>20)
Twice
Four times
None (*)
Eight times
Once
Hosted subprogram
Local subprogram (*)
Limited subprogram
27. A stored PL/SQL procedure can be invoked from which of the following?
A only
A and B
A and C
A, B and C (*)
B and C
True
False (*)
29. A programmer wants to create a PL/SQL procedure named
EMP_PROC. What will happen when the following code is executed?
CREATE OR REPLACE PROCEDURE emp_proc IS
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 999;
DBMS_OUTPUT.PUT_LINE('The salary is: ' || v_salary);
END;
(1) Points
Positional (*)
Named
A combination of positionally and named
A combination of named and defaulted
Defaulted
Section 9
True
False (*)
35. Which of the following is a legal location for a function call in a SQL
statement? (Choose 3) (1) Points
(Choose all correct answers)
True
False (*)
37. Examine the following code (the code of CHILD2 is not shown):
CREATE PROCEDURE child1
IS v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 9999;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END child1;
Employee_id 9999 does not exist. What happens when PARENT is executed?
(1) Points
CHILD1 ends abruptly, PARENT handles the exception successfully and ends.
CHILD2 does not execute.
CHILD1 ends abruptly, then PARENT also ends abruptly with an unhandled
exception.
PARENT handles the exception, then CHILD1 resumes execution.
PARENT fails to compile because you cannot have the same exception handler in
two separate subprograms.
38. The following code shows the dependencies between three procedures:
CREATE PROCEDURE parent
IS BEGIN
child1;
child2;
END parent;
You now try to execute:
39. 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) (1) Points (Choose all correct answers)
Query USER_PARAMETERS
Query USER_SOURCE (*)
Query USER_FUNCTIONS
SHOW PARAMETER my_func;
DESCRIBE my_func; (*)
23
11
66
17 (*)
An error message will be displayed because you cannot nest user-defined
functions.
Section 9
42. Which of the following is a difference between a procedure and a function? (1)
Points
43. You have created a function named NEWFUNC. You now change some
of the function code, and try to recreate the function by executing:
CREATE OR REPLACE FUNCTION newfunc .... ;
What happens?
(1) Points
DECLARE
x NUMBER;
BEGIN
x:= add_em(b=4);
END; (*)
DECLARE
x NUMBER;
BEGIN
x:= add_em(4);
END;
DECLARE
x NUMBER;
BEGIN
x:= add_em(4,5);
END;
DECLARE
x NUMBER;
BEGIN
x:= add_em;
END;
46. How do you specify that you want a procedure MYPROCA to use "Definer's
Rights"? (1) Points
Definer's Rights are the default, therefore no extra code or commands are
needed. (*)
The subprogram will fail because the PRAGMA statement must be before IS.
The subprogram will fail because it is missing AUTHID CURRENT_USER before IS.
The compilation will fail because a semicolon after AUTONOMOUS_TRANSACTION
is required. (*)
The program will compile successfully.
Section 6
49. Examine the following code. To create a row trigger, what code should be
included at Line A?
CREATE TRIGGER dept_trigg
AFTER UPDATE OR DELETE ON departments
-- Line A
BEGIN ...
(1) Points
Which of the following are NOT valid at Line A ? (Choose two.) (1) Points (Choose all
correct answers)
3. Which of the following will successfully return a user - defined error message? (1)
Points
RAISE_APPLICATION_ERROR('Error Raised',22001);
RAISE_APPLICATION_ERROR(-20257,'Error raised'); (*)
RAISE_APPLICATION_ERROR(-22001,'Error Raised');
RAISE_APPLICATION_ERROR('Error Raised',20257);
4. Department-id 99 does not exist. What will be displayed when the following code
is executed?
DECLARE
v_deptname departments.department_name%TYPE;
BEGIN
SELECT department_name INTO v_deptname
FROM departments WHERE department_id = 99;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR(-20201,'Department
does not exist');
END;
EXCEPTION
WHEN OTHERS THEN statement_2;
WHEN NO_DATA_FOUND THEN statement_1;
END;
EXCEPTION
WHEN NO_DATA_FOUND THEN statement_1;
WHEN NO_DATA_FOUND THEN statement_2;
WHEN OTHERS THEN statement_3;
END;
EXCEPTION
WHEN OTHERS THEN statement_1;
END; (*)
6. Examine the following code. Why does the exception handler not follow good
practice guidelines?
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 999;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('An error occurred');
END;
True (*)
False
8. Which of the following are good practice guidelines for exception handling?
(Choose three.) (Choose all correct answers)
Test your code with different combinations of data to see what potential errors can
happen. (*)
Use an exception handler whenever there is any possibility of an error occurring. (*)
Include a WHEN OTHERS handler as the first handler in the exception section.
Allow exceptions to propagate back to the calling environment.
Handle specific named exceptions where possible, instead of relying on WHEN
OTHERS. (*)
10.What will be displayed when the following code is executed? What will be
displayed when the following code is executed?
<<outer>>
DECLARE
v_myvar NUMBER;
BEGIN
v_myvar := 10;
DECLARE
v_myvar NUMBER := 200;
BEGIN
outer.v_myvar := 20;
v_myvar := v_myvar / 0; --this raises a ZERO_DIVIDE error
outer.v_myvar := 30;
END;
v_myvar := 40;
EXCEPTION
WHEN ZERO_DIVIDE THEN
DBMS_OUTPUT.PUT_LINE(v_myvar);
END;
10
20 (*)
30
40
200
True
False (*)
13. Examine the following code. What is the scope and visibility of the outer block's
v_last_name?
DECLARE
v_last_name VARCHAR2(20);
BEGIN
DECLARE
v_last_name VARCHAR2(20);
BEGIN
...
END:
...
END;
14. The following code does not violate any constraints and will not
raise an ORA-02292 error. What will happen when the code is executed?
BEGIN
DECLARE
e_constraint_violation EXCEPTION;
PRAGMA EXCEPTION_INIT(e_constraint_violation, -2292);
BEGIN
DBMS_OUTPUT.PUT_LINE('Inner block message');
END;
EXCEPTION
WHEN e_constraint_violation THEN
DBMS_OUTPUT.PUT_LINE('Outer block message');
END;
Inner block message' will be displayed.
The code will fail because the exception is declared in the inner block but is
referenced in the outer block.(*)
Outer block message' will be displayed.
The code will fail because line 4 should read: PRAGMA EXCEPTION_INIT(-2292,
e_constraint_violation);
WHEN CURSOR_NOT_OPEN
WHEN INVALID_CURSOR (*)
WHEN OTHERS (*)
WHEN NO_DATA_FOUND
WHEN INVALID_FETCH
16. Which of the following best describes a predefined Oracle Server error? (1)
Points
Has a standard Oracle error number but must be named by the PL/SQL programmer
Is not raised automatically but must be declared and raised explicitly by the PL/SQL
programmer
Has a standard Oracle error number and a standard name which can be referenced
in the EXCEPTION section (*)
Is associated with an Oracle error number using PRAGMA EXCEPTION_INIT
17. Examine the following code. What message or messages will be displayed when
this code is executed?
DECLARE
v_last_name employees.last_name%TYPE;
v_number NUMBER := 27;
BEGIN
v_number := v_number / 0;
SELECT last_name INTO v_last_name FROM employees
WHERE employee_id = 999;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No rows were found');
WHEN ZERO_DIVIDE THEN
DBMS_OUTPUT.PUT_LINE('Attempt to divide by zero');
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('An error occurred');
END;
19. Examine the following code fragment. At Line A, you want to raise an
exception if the fetched salary value is greater than 30000. How can you do this?
DECLARE
v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 100;
IF v_salary > 30000 THEN
--Line A
END IF;
...
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(-02290,e_sal_excep);
DECLARE
PRAGMA EXCEPTION_INIT(e_sal_excep,-02290);
e_sal_excep EXCEPTION;
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(e_sal_excep,-02290); (*)
DECLARE
e_sal_excep EXCEPTION;
PRAGMA_EXCEPTION_INIT(e_sal_exception,-02290);
DECLARE
e_sal_excep EXCEPTION;
PRAGMA EXCEPTION_INIT(e_sal_excep,02290);
21. You have created a procedure named MYPROC that accepts three
IN parameters A, B, and C (all numbers). Which of the following calls to MYPROC is
NOT correct?
myproc(5,10,20);
myproc(a=>5,b=>10,20) (*)
myproc(a=>5,b=>10,c=>20)
myproc(5,10,c=>20)
22. You have created procedure MYPROC with a single parameter PARM1
NUMBER. Now you want to add a second parameter to the procedure. Which
of the following will change the procedure successfully?
23. Which of the following best describes how an IN parameter affects a procedure?
24. Which of the following is NOT correct coding for a procedure parameter?
(p_param IN VARCHAR2)
(p_param VARCHAR2)
(p_param VARCHAR2(50)) (*)
(p_param employees.last_name%TYPE)
(p_param IN OUT VARCHAR2)
25. Which of the following statements about actual parameters is NOT true?
27. Which of the following are characteristics of PL/SQL subprograms but not
of anonymous PL/SQL blocks? (Choose three.) (Choose all correct answers)
28. One PL./SQL subprogram can be invoked from within many applications. True or
False?
True (*)
False
Twice
Four times
None (*)
Eight times
Once
31. A PL/SQL stored procedure can accept one or more input parameters
and can return one or more output values to the calling environment.
True or False?
True (*)
False
32. A PL/SQL procedure named MY_PROC1 has been successfully created in
the database. The procedure has no parameters. Which of the following
will successfully invoke the procedure in Application Express? (Choose
two.) (Choose all correct answers)
DECLARE
v_var1 NUMBER := 20;
BEGIN
my_proc1(v_var1);
END;
EXECUTE my_proc1;
BEGIN
my_proc1;
END; (*)
IN (*)
OUT
NUMBER
VARIABLE
CONSTANT
34. The following procedure has been created:
35. Procedure SOMEPROC has five parameters named A, B, C, D, E in that order. The
procedure was called as follows:
SOMEPROC(10,20,D=>50);
How was parameter D referenced?
Positionally
Named (*)
A combination of positionally and named
A combination of named and defaulted
Defaulted
myproc(40);
myproc(10, B => 30, 50);
myproc(C => 25);
All of the above
None of the above (*)
CHILD1 ends abruptly, PARENT handles the exception, then CHILD2 executes.
CHILD1 ends abruptly, PARENT also ends abruptly and returns an unhandled
exception. xception.
PARENT does not compile because you cannot use NULL; in an exception handler.
38. 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) (Choose all correct answers)
Query USER_PARAMETERS
Query USER_SOURCE (*)
Query USER_FUNCTIONS
SHOW PARAMETER my_funct;
DESCRIBE my_funct; (*)
39. You want to remove the procedure NO_NEED from your schema. You execute:
DROP PROCEDURE no_need;
Which Data Dictionary views are updated automatically?
USER_PROCEDURES
USER_OBJECTS
USER_SOURCE
All of the above. (*)
None of the above.
40. 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?
myfunc('Crocodile') := v_var1;
myfunc(v_var1) := 'Crocodile';
myfunc(v_var1, 'Crocodile');
v_var1 := myfunc('Crocodile'); (*)
myfunc('Crocodile', v_var1);
23
11
66
17 (*)
42. You have created a function named NEWFUNC. You now change some of
the function code, and try to recreate the function by executing:
CREATE OR REPLACE FUNCTION newfunc .... ;
What happens?
44. You try to create a function named MYFUNC. The function does not
compile correctly because there are errors in your code. Which
Dictionary view can you query to see the errors?
USER_SOURCE
USER_ERRORS (*)
USER_OBJECTS
USER_DEPENDENCIES
USER_COMPILES
USER_OBJECTS
USER_DEPENDENCIES
USER_COMPILES
DECLARE
x NUMBER;
BEGIN
x:= add_em(b=4);
END; (*)
DECLARE
x NUMBER;
BEGIN
x:= add_em(4);
END;
DECLARE
x NUMBER;
BEGIN
x:= add_em(4,5);
END;
DECLARE
x NUMBER;
BEGIN
x:= add_em;
END;
They automate repetitive formulas which otherwise you would have to type in full
every time you used them. (*)
They execute faster than system-defined functions such as UPPER and LOWER.
They allow you to execute DML from inside a SELECT statement.
They allow you to use functions which return a BOOLEAN.
They are stored on your local PC, not in the database.
49. How do you specify that you want a procedure MYPROCA to use Invoker's
Rights?
50. How do you specify that you want a procedure MYPROCA to use "Definer's
Rights"?
11. You want to remove the procedure NO_NEED from your schema. You
execute: