Show Me
 

Creating an Anonymous Block

Previous previous|next Next Page

Anonymous blocks are unnamed blocks. They are declared inline at the point in an application where they are to be executed and are compiled each time the application is executed.

  • Anonymous blocks are not stored in the database and they are passed to the PL/SQL engine for execution at run time.
  • You will not be able to to invoke or call the block that you wrote earlier because blocks are anonymous and do not exist after they are executed.
  • Anonymous blocks can serve as nested blocks inside procedures, functions and other anonymous blocks.

For part of the business application, Sheila needs to track the user information such as user name and the reporting time. She wants to create an anonymous block to track the details. The anonymous block should retrieve the user name and store it in a variable called v_user. The date the user ran the report should be displayed in the DD_Mon_YY format.

Help Sheila create an anonymous block to display user name, reporting date, and time.

Launch Demonstration

Show Me and Try It