1Z0-149 practice question 15 of 15

SERVEROUTPUT is enabled. Which is the correct method to use a PACKAGED CONSTANT in SELECT statements?

Full set: 65 questions
Answer options
A: exam question
B: exam question
C: exam question
D: exam question Correct answer
Correct Answer:
D. https://kxbjsyuhceggsyvxdkof.supabase.co/storage/v1/object/public/file-images/1Z0-149/page_33_img_4.jpg
Explanation

Public constants declared in a package specification are accessible from outside the package using the dot notation: packagename.constantname. The provided code defines a package constpack with a public constant cval. To use this constant in a SQL SELECT statement, it must be referenced as constpack.cval. Option D correctly uses this syntax within a PL/SQL block to select the value of the constant from the DUAL table and store it in a local variable.

Why Incorrect

A. This attempts to call a function getval, but the package defines a constant named cval, not a function.
B. This references cval without the package name qualifier. The SQL engine would not know where to find this identifier.
C. The colon prefix (:cval) is used for bind variables, not for referencing PL/SQL package constants in static SQL.

References

1. Oracle Database PL/SQL Language Reference, 12c Release 2 (12.2). Chapter 10, "PL/SQL Packages". Section: "Referencing Package Contents".

2. Oracle Database SQL Language Reference, 12c Release 2 (12.2). Section: "Schema Object Naming". Describes the use of dot notation for object access.

Scroll to Top