default value of a variable at the time of declaration in PL SQL default value of a variable at the time of declaration in PL SQL sql sql

default value of a variable at the time of declaration in PL SQL


Variables are default initialized with NULL.

You can change that, for example:

create procedure show1as  l_start varchar2(10) := 'Hello';begin  if l_start is not null then     ....  end if;end;/

You can also declare variables as not nullable:

create procedure show2as  l_start varchar2(10) not null := 'Hello';begin  null;end;/


Defaults are NULL, you can use IS NULL or IS NOT NULL.


And another small addition: if you're dealing with BLOBs (or CLOBS), "empty" is not the same as null. See the Oracle large objects manual if you need to.