Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle DEFAULT Keyword      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

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      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 173 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?