This script demonstrates the structure of a block : Begin End Block « PL SQL « Oracle PL / SQL






This script demonstrates the structure of a block

    

SQL> SET SERVEROUTPUT ON
SQL>
SQL> DECLARE
  2     myDateTime TIMESTAMP;
  3  BEGIN
  4     SELECT systimestamp INTO myDateTime FROM dual;
  5
  6     DBMS_OUTPUT.PUT_LINE(myDateTime);
  7  EXCEPTION
  8     WHEN OTHERS
  9     THEN
 10        DBMS_OUTPUT.PUT_LINE(sqlerrm);
 11  END;
 12  /
26-OCT-09 10.40.28.139000 AM

PL/SQL procedure successfully completed.

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.Block Nesting
6.The executable section needs at least one line of code to be valid.
7.Five level nested statement
8.no executable code
9.Building Blocks of PL/SQL
10.A Nested Block Example
11.Block with name
12.Outer Block name and inner block name
13.Nested block
14.Plain SQL and PL/SQL program