Quick Search:
 
 The Oracle DEFAULT Keyword      [Return To Index] Jump to:  

Term: DEFAULT

Definition:
The DEFAULT keyword is used to supply a value that is used automatically (i.e. "by default") unless an alternative is specified for the attributes, variables, or parameters. It can be used in various places with the same general effect of supplying a value without explicitly having to do so. For example, DEFAULT can be used:

  1. Within a DECLARE section to assign default values to the variables.
  2. During table creation to assign default values to the columns
  3. IN Parameters can be given default value.

Example Usage:

create table deftab
(
id integer,
datecol date default sysdate,
strcol varchar2(30) default user
)
/
Table created.

DECLARE
L_ID NUMBER DEFAULT 1;
BEGIN
insert into deftab(id)
values(L_ID);
END;

PL/SQL procedure successfully completed

SQL> select * from deftab;

ID DATECOL STRCOL
---------- --------- -------------------
1 16-NOV-10 SYSTEM


Related Links:

Related Code Snippets:
 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org