Which statement is true?

Examine this package:
CREATE OR REPLACE PACKAGE discounts
IS
g_id NUMBER := 7829;
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?

Examine this package:
CREATE OR REPLACE PACKAGE discounts
IS
g_id NUMBER := 7829;
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?

A.
The value of DISCOUNT_RATE always remains 0.00 in a session.

B.
The value of DISCOUNT_RATE is set to 0.10 each time the package is invoked in a session.

C.
The value of DISCOUNT_RATE is set to 1.00 each time the procedure DISPLAY_PRICE is invoked.

D.
The value of DISCOUNT_RATE is set to 0.10 when the package is invoked for the first time in a session.

Explanation:
A one-time-only procedure is executed only once, when the package is first invoked within the user session



Leave a Reply 0

Your email address will not be published. Required fields are marked *