Block Nesting : Begin End Block « PL SQL « Oracle PL / SQL






Block Nesting

  
SQL>
SQL> set serveroutput on
SQL>
SQL> declare
  2    myText varchar2(20);
  3  begin
  4    myText := 'First Block';
  5    dbms_output.put_line(myText);
  6    declare
  7      l_more_text varchar2(20);
  8    begin
  9      l_more_text := 'Second Block';
 10      dbms_output.put_line(l_more_text);
 11     end;
 12  end;
 13  /
First Block
Second Block

PL/SQL procedure successfully completed.

SQL>
SQL>

   
  








Related examples in the same category

1.Three sections - declarative, executable, and exception.
2.An example of an anonymous block
3.Block-Based Development
4.The PL/SQL Block
5.The executable section needs at least one line of code to be valid.
6.Five level nested statement
7.no executable code
8.Building Blocks of PL/SQL
9.A Nested Block Example
10.Block with name
11.Outer Block name and inner block name
12.This script demonstrates the structure of a block
13.Nested block
14.Plain SQL and PL/SQL program