NULL as a statement inside IF : NULL Statement « PL SQL « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » PL SQL » NULL Statement 
NULL as a statement inside IF
 

SQL>
SQL> CREATE TABLE MyTable (
  2    num_col    NUMBER,
  3    char_col   VARCHAR2(60)
  4    );

Table created.

SQL>
SQL>
SQL> DECLARE
  2    v_TempVar  NUMBER := 7;
  3  BEGIN
  4    IF v_TempVar < THEN
  5      INSERT INTO MyTable (char_col)
  6        VALUES ('Too small');
  7    ELSIF v_TempVar < 20 THEN
  8      NULL; -- Do nothing
  9    ELSE
 10      INSERT INTO MyTable (char_col)
 11        VALUES ('Too big');
 12    END IF;
 13  END;
 14  /

PL/SQL procedure successfully completed.

SQL>
SQL> select from MyTable;

no rows selected

SQL>
SQL>
SQL> drop table MyTable;

Table dropped.

SQL>
SQL>
SQL>

 
Related examples in the same category
1.Empty procedure with 'NULL' statement
2.Null statement means nothing
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.