Block-Based Development : Begin End Block « PL SQL « Oracle PL / SQL






Block-Based Development

  
SQL>
SQL> set serveroutput on
SQL> declare
  2    myText varchar2(100);
  3  begin
  4    myText := 'Hello, World!';
  5    dbms_output.put_line(myText);
  6  exception
  7    when others then
  8      dbms_output.put_line('We encountered an exception!');
  9      raise;
 10  end;
 11  /
Hello, World!

PL/SQL procedure successfully completed.

SQL>
SQL>

SQL>

   
  








Related examples in the same category

1.Three sections - declarative, executable, and exception.
2.An example of an anonymous block
3.The PL/SQL Block
4.Block Nesting
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