Table of Contents
Question
Which two are true about named notations in a PL/SQL subprogram? (Choose two.)
A. The actual parameters must be specified in the same order as the formal parameters are declared.
B. Specifying actual parameters in the wrong order results in the subprogram terminating with an exception.
C. Only trailing optional parameters can be omitted in the invocation call.
D. The subprogram invocations must be changed when the formal parameter list acquires new required parameters.
E. Any optional parameters can be omitted in the invocation call.
Answer
A. The actual parameters must be specified in the same order as the formal parameters are declared.
E. Any optional parameters can be omitted in the invocation call.
Explanation
Answer:
A. The actual parameters must be specified in the same order as the formal parameters are declared.
E. Any optional parameters can be omitted in the invocation call.
Named notations in PL/SQL allow you to pass actual parameters to a subprogram (procedure or function) by explicitly specifying the formal parameter names along with the corresponding values. This provides more flexibility in parameter passing and makes the code more readable and maintainable. Let’s explore each option:
A. The actual parameters must be specified in the same order as the formal parameters are declared.
This statement is true. When using named notations, you still need to provide the actual parameters in the same order as the formal parameters are declared in the subprogram’s definition. However, by explicitly using parameter names, the order in which you provide the parameters during invocation is not critical. Named notation provides more flexibility in the order of parameter values.
B. Specifying actual parameters in the wrong order results in the subprogram terminating with an exception.
This statement is false. When using named notations, specifying actual parameters in a different order than the formal parameters will not terminate the subprogram with an exception. As mentioned earlier, named notation allows more flexibility in the order of the parameter values during invocation.
C. Only trailing optional parameters can be omitted in the invocation call.
This statement is false. With named notation, any optional parameter can be omitted in the invocation call, not just trailing optional parameters. By using the parameter name, you can selectively pass values for specific parameters, leaving others as default values.
D. The subprogram invocations must be changed when the formal parameter list acquires new required parameters.
This statement is true. If you add new required parameters to the formal parameter list of a subprogram, the invocations of that subprogram using named notation must be updated to include values for the new required parameters. Otherwise, the compilation will fail.
E. Any optional parameters can be omitted in the invocation call.
This statement is true, but it is not exclusive to named notations. Whether you use positional notation or named notation, you can omit any optional parameters in the invocation call. Optional parameters have default values defined in the subprogram’s definition, so you don’t need to provide values for them during invocation unless you want to override the defaults.
In conclusion, for named notations in a PL/SQL subprogram:
A. The actual parameters must be specified in the same order as the formal parameters are declared.
E. Any optional parameters can be omitted in the invocation call.
Reference
- Database PL/SQL Language Reference (oracle.com)
- Database Development Guide (oracle.com)
- Oracle PL/SQL Parameter Positional and Named Notation (demo2s.com)
- PL/SQL Subprograms (oracle.com)
Oracle Database Program with PL/SQL 1z0-149 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Oracle Database Program with PL/SQL 1z0-149 exam and earn Oracle Database Program with PL/SQL 1z0-149 certification.