Oracle PL/SQL Difference between Procedures, Functions, Packages - 2

Question: 6

What is an anonymous block?

Any PL/SQL block, which does not have a name, is called an anonymous block. It is directly written in the application code and complied by the PL/SQL engine at the time of execution.

Question: 7

What does the REPLACE option indicates in the procedure definition?

The REPLACE option specifies that if the procedure with the same name exists in the database, it will be dropped and recreated in the database as a new version.

Question: 8

Can default values be assigned to IN OUT parameters procedure?

No, default values cannot be assigned to IN OUT parameters; only IN parameters can be assigned default values.

Question: 9

What is the difference between the code syntax of an anonymous block and named sub program block?

A sub program has two parts: sub program specification and sub program body.

The sub program specification is the header section, which contains the details such as program name, sub program type parameter list, and return clause (for functions).

The sub program body is a PL/SQL block, which has the declaration, executable, and exception sections.

An anonymous block has no specification or header section. It only consists of a PL/SQL block in the body that contains the declaration, executable, and exception sections.

Question: 10

How can a parameter be initialized in a procedure?

The IN OUT parameter mode can be used to initialize a parameter in a procedure, as any value can be initially assigned to this parameter when the procedure is called from the calling environment.

The value of this parameter can be changed during the execution of the procedure and the result can be returned back to the calling environment from the procedure.

Related Questions