Major Data Types of database Classification
All object hava a name and atype, and each object is owned by a schema.
-- Query the main object types of a Database
Selectobject_type, count (object_type) from dba_objects
Group by object_typeorder by object_type;
Naming rules for database objects
1. The object name can contain a maximum of 30 characters, except databaselink. It can contain a maximum of 128 characters;
2. reserved keywords cannot be used for object names;
3. The object name must start with a letter
4. The object name can only contain three types of symbols: _ $ #
5. lowercase letters are automatically converted to uppercase letters.
6. If double quotation marks are used, the above rules can be broken.
Object namespace
The following objects use the same namespace:
TABLE |
VIEWS |
SEQUENCES |
PRIVATE SYNONYMS |
STAND-ALONE PROCEDURES |
STAND-ALONE FUNCTIONS |
PACKAGES |
MATERIALIZED VIEWS |
USER-DEFINED TYPES |
The following objects have their own namespace
INDEX |
CONSTRAINTS |
CLUSTERS |
DATABASE TRIGGERS |
PRIVATE DATABASE LINKS |
DIMENSIONS |
Lists the data types available for data columns.
Character Type
VARCHAR2 |
Variable-length character type, 1byte-4KB, and VARCHAR type, which is automatically converted to VARCHAR2 |
NVARCHAR2 |
Similar to VARCHAR2, but can store international codes; |
CHAR |
The fixed length is 1 byte-2kb. If the character length is insufficient, use spaces to fill it up; |
Value Type
NUMBER |
Precision (1 to 38) sacle (-84,127) NUMBER (precision, scale) Precision indicates the valid digit in the number. If precision is not specified, Oracle uses 38 as the precision. Scale indicates the number of digits to the right of the decimal point. scale is set to 0 by default. If scale is set to a negative number, Oracle will select this number to the specified number to the left of the decimal point. |
FLOAT |
Precision (138) BINARY_FLOAT BINARY_DOUBLE |
INTEGER |
Equivalent to NUMBER, with scale zero |
Time Type
DATE |
Century, year, month, day, hour, minute, second range from January 1, 4712 BC, to December 31, 9999 after the ad, can be blank or 7 bytes |
TIMESTAMP |
Similar to date, but the second accuracy is more accurate. It can be null or 11 bytes. |
TIMESTAMP WITH TIMEZON |
|
TIMESTAMP WITH LOCAL TIMEZONE |
|
INTERVAL YEAR TO MONTH |
|
INTERVAL DAY TO SECOND |
|
Big Data Type
CLOB |
|
NCLOB |
|
BLOB |
|
BFILE |
|
LONG |
|
LONG RAW |
|
Other Types