CoderZone.org

Category: >> Oracle PL/SQL >> TABLE - Constraints Bookmark and Share

<< lastnext >>

Snippet Name: TABLE - Constraints

Description: Creating a table with NOT NULL constraints

Also see:
» TABLESPACE: Show contiguous space
» TABLESPACE: SYSAUX tablespace
» TABLESPACE: Tablespace management
» TABLESPACE: List tablespaces, fil...
» TABLESPACE: Dropping Tablespaces
» TABLESPACE: Alter Permanent Tables...
» TABLESPACE: Transportable tablespa...
» TABLESPACE: Tempfile operations
» TABLESPACE: Create temp tablespace
» TABLESPACE: Change UNDO tablespace
» TABLESPACE: Undo Tablespace
» TABLESPACE: SYSAUX Tablespace
» TABLESPACE: Set default tablespace...
» TABLESPACE: Oracle Managed Auto-ex...
» TABLESPACE: Permanent Tablespace U...
» TABLE - Options
» TABLE - Using Select Statement Wi...
» TABLE - Multiple Columns
» TABLE - queries
» TABLE - simple heap table
» TABLESPACE: Using Raw Devices
» TABLESPACE: permanent tablespace

Comment: (none)

Author: CoderZone
Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 11th, 2009

CREATE TABLE test6 (
id   NUMBER(5) NOT NULL,
f_name VARCHAR2(20),
l_name VARCHAR2(25));
 
ALTER TABLE test6 MODIFY (id NULL);
 
ALTER TABLE test6  MODIFY (id NOT NULL);
 
 
-- For example, a column in a table can be specified NOT NULL. 
-- It's not possible to insert a null in such a column. In the following 
-- create table statement, a null can be inserted into the column named c. 
 
CREATE TABLE ri_not_null (
  a NUMBER NOT NULL,
  b NUMBER     NULL,
  c NUMBER
);
 
INSERT INTO ri_not_null VALUES (   1, NULL, NULL);
INSERT INTO ri_not_null VALUES (   2,    3,    4);
INSERT INTO ri_not_null VALUES (NULL,    5,    6);
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 30