Which statements correctly describe the features of functions and procedures? (Choose all that apply.)
A. A procedure can contain a return statement without a value.
B. A function can return multiple values using a single return clause.
C. A procedure can be executed as part of a SQL expression or as a PL/SQL statement,
D. A function can contain zero or more parameters that are transferred from the calling environment.
Answers AD are correct.
For A,B reference already given:
http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/subprograms.htm (using the return statement)
C is NOT correct. This can be tested by trying to embed procedure into SQL expression:
SQL> set serveroutput on;
SQL> exec dbms_output.put_line(‘Test’);
Test
D is correct. Example of function with zero parameters:
SQL> select CURRENT_DATE from dual;
CURRENT_D
———
10-MAY-19
Example of function with one parameter:
select count(*) from dual;
PL/SQL procedure successfully completed.
SQL> select dbms_output.put_line(‘Test’) from dual;
select dbms_output.put_line(‘Test’) from dual
*
ERROR at line 1:
ORA-00904: “DBMS_OUTPUT”.”PUT_LINE”: invalid identifier