CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
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, files, ...
» TABLESPACE: Dropping Tablespaces
» TABLESPACE: Alter Permanent Tablespace
» TABLESPACE: Transportable tablespaces
» TABLESPACE: Tempfile operations
» TABLESPACE: Create temp tablespace
» TABLESPACE: Change UNDO tablespace
» TABLESPACE: Undo Tablespace
» TABLESPACE: SYSAUX Tablespace
» TABLESPACE: Set default tablespace type
» TABLESPACE: Oracle Managed Auto-extend...
» TABLESPACE: Permanent Tablespace Using...
» TABLE - Options
» TABLE - Using Select Statement With D...
» TABLE - Multiple Columns
» TABLE - queries
» TABLE - simple heap table
» TABLESPACE: Using Raw Devices
» TABLESPACE: permanent tablespace
Comment: (none)
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 ) ;
SQL University.net courses meet the most demanding needs of the business world for advanced education
in a cost-effective manner. SQL University.net courses are available immediately for IT professionals
and can be taken without disruption of your workplace schedule or processes.
Compared to traditional travel-based training, SQL University.net saves time and valuable corporate
resources, allowing companies to do more with less. That's our mission, and that's what we deliver.
Click here to find out more
30 users online
© 2009 psoug.org