Increte the data type in Oracle

xiaoxiao2021-03-06  19

When you create a data table in the database, you need to define the type of all fields in the table. Oracle has many data types to meet your needs. The data type is approximately: CHARACTER, NUMBER, DATE, LOB, and RAW. Although Oracle8i also allows you to customize the data type, they are the most basic data type. In the following article you will learn about the usage, restrictions, and allowable values ​​in Oracle.

l Character data type

The Character data type is used to store alphanumeric data. When you define a character data in Oracle, you usually need to make the length of the field, which is the maximum length of the field. Oracle offers the following types of Character data types:

Char () CHAR data type is a string with fixed length and maximum length. The data stored in the data type as the Char field will be maximized in the form of space. The length is defined between 1-2000 bytes.

When you create a CHAR field, the database will ensure that all data in this field is defined in length. If a data is shorter than the defined length, the space will be replenished with the definition length in the right side of the data. If the length is greater than the defined length, an error message will be triggered.

VARCHAR () VARCHAR type data is a snapshot of VARCHAR2 data.

VARCHAR2 () VARCHAR2 data type is a variable length, a maximum length of alphanumeric data. VARCHAR2 type field length can reach 4000 bytes, and VARCHAR2 type variable length can reach 32676 bytes.

The space occupied by an empty VARCHAR2 (2000) field and an empty VARCHAR2 (2) field is the same.

Nchar () and nvarchar2 () Nchar () and nVarchar2 () data types are the same as Char () and varchar2 () type, only They are used to store NLS (National Language Support).

The long long data type is a legacy and the type of data that will not be supported in the future. It will be replaced by the LOB (Large Object) data type.

The comparative rules varchar2 and char data types have different comparative rules depending on the spaces of the tail. For CHAR type data, the space in the tail will be ignored, and the data sorted by the VARCHAR2-type data tail belt space is larger than the space. such as:

CHAR type data: 'yo' = 'yo'

VARCHAR2 data: 'Yo' <'yo'

l Numberic data type

Numberic data types are used to store negative and positive integers, scores, and floating-point data, with 38 accuracy between -1 * 10-103 and 9.999 ... 99 * 10125. An error occurred when you lognowledge a data beyond this range.

Number (

, ) Number data type stores a S-bit level of the P bit accuracy.

l Date data type

The Date data type is used to store data in the date and time format. This format can be converted to other formatted data to browse, and it has special functions and properties to control and calculate. The following information is included in the DATE data type:

Ø Century

Ø Year

Ø MONTH

Ø Day

Ø Hour

Ø minute

Ø second

LOB data type

LOB (Large Object) data type stores non-structured data, such as binaries, graphics files, or other external files. LOB can store 4G byte size. Data can be stored in the database or in an external data file. The control of the LOB data is implemented via the DBMS_LOB package. BLOB, NCLOB, and Clob data can be stored in different tablespaces, and bfile is stored in an external file on the server. LOB data types have the following: Ø BLOB: binary data

Ø CLOB: Characteristic data

Ø bfile: binary file

Other data types

转载请注明原文地址:https://www.9cbs.com/read-42538.html

New Post(0)