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 questionsPublic 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.
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.
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.
Keep practicing
Take the free 1Z0-149 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 1Z0-149 practice questions
- Question 3Which two PL/SQL elements can be deprecated using the DEPRECATE pragma? (Choose two.)
- Question 5Which two statements are true about using the OR REPLACE clause when creating named subpr…
- Question 6Which three are true about functions and procedures? (Choose three.)
- Question 8Which two are true about the PLSQL_CODE_TYPE parameter? (Choose two.)
- Question 9Which three SQL statements, embedded in PL/SQL, typically benefit from using variables de…
- Question 11SERVEROUTPUT is enabled. Which code block will display the values from 1 to 10 in descend…
