In this blog i will give an example of creating Anonymous Block in SQL :
First of all you have to use the server output on so it can show you the result of your Anonymous Block .
Secondly you can declare any variable you want to use , and then begin work on it , you can use loops if want to , it is up to you what do you want with this Anonymous Block .
And finally you have to close everythig by using the keyword END;
This a simple example of Anonymous Block PL SQL that will print (Hello World).
SET SERVEROUTPUT ON
DECLARE
TXT VARCHAR2(20) = ‘Hello World’;
BEGIN
DBMS_OUTPUT.PUT_LINE(TXT);
END;
The result will be = Hello World
Written by : Mohammed Alaslani