How to Create An Anonyms Block in PL/SQL

In this article I am going to explain how to create an anonyms block in PL/SQL.
  • 2179

Introduction

PL/SQL is define as procedure language/structure query language.  PL/SQL is developed by oracle. PL/SQL supports many feature like variables, loops, conditions  and exceptions. It also support the concept of array. In present time PL/SQL is integrated component of oracle software. SQL provide limited support for advance programming and PL/SQL fill this gap.

Block is a basic unit of a PL/SQL application. This block is collection of PL/SQL statements grouped as logical unit. Using  PL/SQL blocks you can create five different type of program units.

  • Stored Function
  • Stored procedure
  • Anonymous Block
  • Trigger
  • Package

Anonyms Block in PL/SQL

An anonyms block is an most basic and common block of PL/SQL. It is known as anonyms because it doesn't have any name and not stored in oracle database as object. It does not  have any argument and return any value.

Example

DECLARE
max_value CONSTANT INT :=10;
x int :=1;
BEGIN
FOR x IN 1 .. max_value loop
INSERT into record_info VALUES (x, sysdate);
END LOOP;
END;

Statement that show data from record_info table


© 2019 DotNetHeaven. All rights reserved.