Anonymous PL/SQL Block
Definition :
The PL/SQL block that has no name is called Anonymous PL/SQL Block.
Structure :
Since the Anonymous Blocks have no names , therefore the header section is completely missing. They only consist of two sections :
- Declaration Section
- Exception Section
Internal Working of Anonymous Blocks:
Firstly the user writes the source code i.e. the Anonymous block in this case and triggers it . The end user act as the client ( e.g. SQL* Plus session ).
After it is triggered , SQL *Plus sends the entire code to the Server through the network.
Once it reaches the server , the SQL engine performs the following 3 process :
Parsing – The PL /SQL Parser checks the code for syntactical errors and also whether the associated objects exists and are accessible.
Compilation – The PL/SQL Compiler next compiles the code , Once compilation is complete , the code then enters the Execution phase.
Problems with Anonymous Blocks :
Traffic – Jam over the Client – Server Network / Speed Slowness :
As mentioned above that in Anonymous block , the entire code from client travels over the network to reach the server , hence this creates a traffic jam on the network which causes slowness of speed.
Performance Issue :
Moreover when these multiple lines of codes from multiple clients reaches the sever , parsing and compilation process happens for thousands of lines of code which causes performance issue.