You define table columns to hold your data. When you create a column, you specify the following attributes:
The data type attribute defines the kind of data to be stored in the column. When you create a table, you must specify a data type for each of its columns.
Data types define the domain of values that each column can contain. For example, DATE
columns cannot accept the value February 29
(except for a leap year) or the values 2
or SHOE
. Each value subsequently inserted in a column assumes the column data type. For example, if you insert 17-JAN-2004
into a date column, then Oracle Database treats that character string as a date value after verifying that it converts to a valid date.
Table 8-1 lists some common Oracle Database built-in data types.
Table 8-1 Common Data Types
Data Type | Description |
---|---|
|
Variable-length character string having a maximum length of You can use the See Oracle Database Globalization Support Guide for more information. |
|
Number having precision |
|
A composite value that includes both a date and time component. For each |
A character large object (CLOB) containing single-byte or multibyte characters. Both fixed-width and variable-width character sets are supported, both using the database character set. The maximum size is (4 gigabytes - 1) * (database block size). For example, for a block size of 32K, the maximum CLOB size is 128 terabytes. |
Constraints determine valid values for the column. In SQL Developer, the only constraint you can define at the column level in the Create Table dialog box page is the NOT NULL
constraint, which requires that a value be included in the column whenever a row is inserted or updated. Unlike other constraints described in "About Table-Level Constraints", which can be defined as part of the column definition or part of the table definition, the NOT NULL
constraint must be defined as part of the column definition.
Use a NOT NULL
constraint when data must be supplied for a column for the integrity of the database. For example, if all employees must belong to a specific department, then the column that contains the department identifier must be defined with a NOT NULL
constraint. However, do not define a column as NOT NULL
if the data can be unknown or may not exist when rows are added or changed. An example of a column for which you must not use a NOT
NULL
constraint is the second, optional line in a mailing address.
The database automatically adds a NOT NULL
constraint to the column or columns included in the primary key of a table.
This value is automatically stored in the column whenever a new row is inserted without a value being provided for the column. You can specify a default value as a literal or as an expression. However, there are limitations on how you construct the expression. See Oracle Database SQL Language Reference for details.
You can enable automatic encryption for column data. See the discussion of Transparent Data Encryption in Oracle Database 2 Day + Security Guide for more information.