Add new column with default value and not null : Add Column « Table « 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 » Table » Add Column 
Add new column with default value and not null
  

SQL> create table registrations
  2  attendee    NUMBER(4)
  3  , course      VARCHAR2(6)
  4  , begindate   DATE
  5  , evaluation  NUMBER(1)
  6  , constraint  R_PK        primary key (attendee,course,begindate)
  7  ;

Table created.

SQL>
SQL>
SQL> alter table registrations
  2  add  (entered_by number(4default not null);

Table altered.

SQL>
SQL>
SQL> drop table registrations;

Table dropped.

   
    
  
Related examples in the same category
1.Add a char type column to a table
2.Add a date type column to a table
3.Alter table: add a column to an existing table
4.Add two columns to a table
5.Alter a table to add two columns and use select to check
6.Alter table to add two columns and then drop them
7.Alter table to add a column and then add constraint to it
8.Alter table to add a column and then add 'check' constraint to it
9.Alter table to add a primary key
10.Alter table to add varray type column
11.Alter table to add date type column
12.Add more columns
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.