文档介绍:Exam : 1Z0-147
Title : Oracle 9i: Program with PL/SQL
Ver :
1Z0-147
QUESTION 1
Examine this function:
CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG
(V_ID in %TYPE)
RETURN NUMBER
IS
V_AVG NUMBER;
BEGIN
SELECT HITS / AT_BATS
INTO V_AVG
FROM PLAYER_BAT_STAT
WHERE PLAYER_ID = V_ID;
RETURN (V_AVG);
END;
Which statement will essfully invoke this function in SQL *Plus?
A. SELECT CALC_PLAYER_AVG(PLAYER_ID)
FROM PLAYER_BAT_STAT;
B. EXECUTE CALC_PLAYER_AVG(31);
C. CALC_PLAYER('RUTH');
D. CALC_PLAYER_AVG(31);
E. START CALC_PLAYER_AVG(31)
Answer: A
Incorrect Answers
B. You can't call a function in this way, in this way you can call a procedure, because function must return a
value, to call a function using mand you should declare a bind variable using the
mand then assign the value returned from the function to this variable, in the following
way:
SQL> VARIABLE v_get_value NUMBER
SQL> EXECUTE :v_get_value := CALC_PLAYER_AVG(31)
PL/SQL procedure pleted.
SQL> PRINT v_get_value
V_GET_VALUE
-----------
C. Again this way can't be use for calling a function in PL/SQL block because the function return a value
and this values must be assigned to PL/SQL variable or to bind variable. Like this
DECLARE
v_get_from_fn NUMBER;
BEGIN
v_get_from := CALC_PLAYER_AVG(31);
END;
/
D. Same as C.
E. START is use to execute a script.
- The Power of Knowing
1Z0-147
QUESTION 2
Which three are true statements about dependent objects? (Choose three)
A. Invalid objects cannot be described.
B. An object with status of invalid cannot be a referenced object.
C. The Oracle server automatically records dependencies among objects.
D. All schema objects have a status that is recorded in the data dictionary.
E. You can view whether an object is valid or invalid in the USER_STATUS data dictionary view.
F. You can view whether an object is valid or in