Oracle
1Z0-147 · Question #5
Examine this package: CREATE OR REPLACE PACKAGE discounts IS g_id_NUMBER := 7839; discount_rate NUMBER := 0.00; PROCEDURE display_price (p_price NUMBER); END discounts; / CREATE OR REPLACE PACKAGE…
The correct answer is D. The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session. See the full explanation below for the reasoning.
Question
Examine this package:
CREATE OR REPLACE PACKAGE discounts
IS
g_id_NUMBER := 7839;
discount_rate NUMBER := 0.00;
PROCEDURE display_price (p_price NUMBER);
END discounts;
/
CREATE OR REPLACE PACKAGE BODY discounts
IS
PROCEDURE display_price (p_price NUMBER)
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('discounted ' ||
TO_CHAR(p_price*NVL(discount_rate, 1)));
END display_price;
BEGIN
discount_rate := 0.10;
END discounts;
/
Which statement is true?
Options
- AThe value of DISCOUNT_RATE always remains 0.00 in a session.
- BThe value of DISCOUNT_RATE is set to 0.10 each time the package is invoked in a session.
- CThe value of DISCOUNT_RATE is set to 1.00 each time the procedure DISPLAY_PRICE is invoked.
- DThe value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session.
How the community answered
(29 responses)- A17% (5)
- B3% (1)
- C7% (2)
- D72% (21)
Community Discussion
No community discussion yet for this question.