A PL/SQL Block : Code Block « PL SQL Programming « Oracle PL/SQL Tutorial






SQL>
SQL>
SQL> CREATE TABLE myItemTable (
  2     item_code varchar2(6) PRIMARY KEY,
  3     item_descr varchar2(20) NOT NULL);

Table created.

SQL>
SQL>
SQL> DECLARE
  2    v_item_code VARCHAR2(6);
  3    v_item_descr VARCHAR2(20);
  4  BEGIN
  5    v_item_code :='Java2s';
  6    v_item_descr :='a web site for Oracle';
  7    INSERT INTO myItemTable VALUES (v_item_code,v_item_descr);
  8  EXCEPTION WHEN OTHERS THEN
  9    dbms_output.put_line(SQLERRM);
 10  END;
 11  /
ORA-06502: PL/SQL: numeric or value error: character string buffer too small

PL/SQL procedure successfully completed.

SQL>
SQL> select * from myItemTable;

no rows selected

SQL>
SQL> drop table myItemTable;

Table dropped.

SQL>
SQL>








24.4.Code Block
24.4.1.This is an anonymous procedure, so it has no name
24.4.2.A PL/SQL Block
24.4.3.Uses a PL/SQL Nested Block
24.4.4.Inline procedure
24.4.5.the forward slash on a line by itself says execute this procedure
24.4.6.Inner function
24.4.7.Select the first names for the Doe family from the Worker table.
24.4.8.Inner procedure in an anonymous function
24.4.9.Demonstrate nested PL/SQL blocks