PL/SQL - Block

Card Puncher Data Processing

About

Language - Code Block (Grouping of Statement)

Syntax

<< label >> (optional)
DECLARE    -- Declarative part (optional)
  -- Declarations of local types, variables, & subprograms

BEGIN      -- Executable part (required)
  -- Statements (which can use items declared in declarative part)

[EXCEPTION -- Exception-handling part (optional)
  -- Exception handlers for exceptions (errors) raised in executable part]
END;

Tools / Trick

Generating PL/SQL block in SQL

SELECT
    CASE
      WHEN MIN(rownum) over () = rownum
      THEN 'BEGIN '
        || statement 
      WHEN MAX(rownum) over () = rownum
      THEN statement
        || 'END;'
        || '/'
      ELSE statement
    END AS BEGIN
from 
whateverTable;

Documentation

See block





Discover More
Card Puncher Data Processing
PL/SQL - Case Statement

The case statement is a Flow / Control Structure PL/SQL provides two forms of case statement. Like any PL/SQL blocks, CASE statements can be labeled. The CASE statement: begins with the keyword...



Share this page:
Follow us:
Task Runner