Section 8
When creating a procedure, where in the code must the
parameters be listed?
After
the keyword IS or AS
Before
the procedure name
After
the keyword PROCEDURE
After
the procedure name (*)
What are the types of parameter
modes?
LOCAL,
GLOBAL, BOTH
CONSTANT,
VARIABLE, DEFAULT
CHARACTER,
NUMBER, DATE, BOOLEAN
IN,
OUT, IN OUT (*)
Suppose you set up a parameter
with an explicit IN mode. What is true about that parameter?
It
cannot have a DEFAULT value.
It acts
like a constant (its value cannot be changed inside the subprogram). (*)
It must
have a DEFAULT value.
It
inherits its type from the matching OUT parameter.
It must
be the same type as the matching OUT parameter.
Which kind of parameters cannot
have a DEFAULT value?
CONSTANT
IN
R(ead)
W(rite)
OUT (*)
Procedure NUMPROC has been
created as:
CREATE PROCEDURE numproc
(x NUMBER, y NUMBER
:= 100, z NUMBER) IS BEGIN ....
You want to call the procedure, passing arguments of 10 for
X and 20 for Z. Which one of the following calls is correct?
numproc(x=>10,20);
numproc(x=10,z=20);
numproc(10,,20);
numproc(10,z=>20);
(*)
Which
of the following are benefits of using PL/SQL subprograms rather than anonymous
blocks? (Choose three.)
Code
reuse (*)
Easier
code maintenance (*)
Better
data security (*)
Stored
externally
Do not
need to define exceptions
A PL/SQL procedure named MYPROC
has already been created and stored in the database. Which of the following
will successfully re-create the procedure after some changes have been made to
the code?
None of
these, because the procedure must be dropped before it can be re-created.
CREATE
OR REPLACE PROCEDURE myproc IS .... (*)
CREATE
PROCEDURE myproc IS ...
UPDATE
PROCEDURE myproc IS ...
ALTER
PROCEDURE myproc IS ...
The following are the steps
involved in creating, and later modifying and re-creating, a PL/SQL procedure
in Application Express. In what sequence should these steps be performed?
Retrieve the saved code from "Saved SQL" in SQL
Commands
Execute the code to create the procedure
Execute the code to re-create the procedure
Click on the "Save" button and save the procedure
code
Modify the code in the SQL Commands window
Type the procedure code in the SQL Commands window
E,D,F,C,A,B
F,B,D,A,E,C
(*)
F,B,D,E,A,C
F,C,A,B,E,D
F,B,C,D,E,A
A stored procedure add_dept may
be invoked by the following command in Application Express. True or False?
BEGIN
add_dept;
END;
True
(*)
False
Which of the following keywords
MUST be included in every PL/SQL procedure definition? (Choose three.)
(Choose
all correct answers)
IS or
AS (*)
DECLARE
REPLACE
BEGIN
(*)
END (*)
A
procedure will execute faster if it has at least one parameter.
True
False
(*)
You want to create a procedure
named SOMEPROC which accepts a single parameter named SOMEPARM. The parameter
can be up to 100 characters long. Which of the following is correct syntax to
do this?
CREATE
PROCEDURE someproc
(someparm 100)
IS
BEGIN ...
CREATE
PROCEDURE someproc
IS
(someparm
VARCHAR2;)
BEGIN...
CREATE
PROCEDURE someproc
(someparm
varchar2)
IS
BEGIN ...
(*)
CREATE
PROCEDURE someproc
(someparm
varchar2(100) )
IS
BEGIN...
CREATE
PROCEDURE someproc
someparm
varchar2(100);
IS
BEGIN...
Procedure SUBPROC was created as:
CREATE PROCEDURE subproc
(p_param VARCHAR2)
IS BEGIN ...
You invoke the procedure by:
DECLARE
v_param VARCHAR2(20)
:= 'Smith';
BEGIN
subproc(v_param);
END;
Which of the following is the actual parameter?
p_param
Smith'
v_param
(*)
None of
these.
What is the purpose of using
parameters with stored procedures?
They
speed up the execution of the procedure.
They
prevent the procedure from modifying data in the database.
They
allow values to be passed between the calling environment and the procedure.
(*)
They
count the number of exceptions raised by the procedure.
Which of the following statements
about actual parameters is NOT true?
An
actual parameter must be the name of a variable. (*)
The
datatypes of an actual parameter and its formal parameter must be compatible.
An
actual parameter can have a TIMESTAMP datatype.
An
actual parameter is declared in the calling environment, not in the called
procedure.
An
actual parameter can have a Boolean datatype.
ty
ReplyDelete