Oracle Base data types

Source: Internet
Author: User
Tags time zones local time

I. Data types in Oracle

Oracle provides a rich data type for storing data, mainly including:

  1, character type: Mainly used to store string type of data.  

Data type

Length

Description

CHAR (n Byte/char)

Default 1 bytes, maximum n value is 2000

Padding at the end to reach the specified length, exceeding the maximum length error. The default length is the number of bytes, and the character length can be from 1 bytes to four bytes.

NCHAR (N)

Default 1 characters, maximum storage content 2000 bytes

Fills the space at the end to the specified length, and n is the number of Unicode characters. The default is 1 bytes.

NVARCHAR2 (N)

Maximum length must be specified, maximum storage content 4000 bytes

Variable length type. n is the number of Unicode characters

VARCHAR2 (n Byte/char)

The maximum length must be specified, at least 1 bytes or 1 characters, and the maximum n value is 4000

Variable length type. Error exceeding maximum length. The default is to store a string of length 0.

VARCHAR

With VARCHAR2

Do not recommend using

  The difference between char, nchar, varchar types

  1, the length of char char is fixed, the longest is 2000 characters, the length is determined according to the declaration; varchar is a variable-length string, and the length is determined by the saved value.

2, varchar is a variable string with a maximum length of 2000, while the VARCHAR2 maximum length is 4000.

  2, Numeric type: Store integer, decimal format data

data type

length

description

Number (P[,s])

P value range 1 to $

S range of values-84 to 127

" stores the fixed-point number with an absolute value range of 1.0 x 10-130 to 1.0 x 10 126. Value greater than or equal to 1.0 x 10 126 times wrong. P is a meaningful 10-digit number, positive s is the number of decimal places, and negative s indicates how many bits are rounded to the left of the decimal point.

5 bytes, There is a length of bytes.

32-bit single-precision floating-point number type. The

Sign bits 1 bits, which are digits 8 bits, and the trailing digits are 23 bits.

9 bytes, There is a length of bytes.

64-bit double-precision floating-point number type.

  3. Date Time Type: Store date format type, including date and time interval

Data type

Length

Description

DATE

7 bytes

The default value is Sysdate year, month, and Day 01. Contains a time field, if the insertion value does not have a Time field, the default value is: 00:00:00 or 12:00:00 for 24-hour and 12-hour clock times. There are no seconds and time zones.

TIMESTAMP [(Fractional_seconds_precision)]

7 to 11 bytes

The fractional_seconds_precision stores the fractional bits of seconds for Oracle, which defaults to 6 and an optional value of 0 to 9. There is no time zone.

TIMESTAMP [(Fractional_seconds_precision)] with time ZONE

13 bytes

Using UTC, contains fields year, MONTH, Day, HOUR, MINUTE, SECOND, Timezone_

HOUR, Timezone_minute

TIMESTAMP [(Fractional_seconds_precision)] with LOCAL time ZONE

7 to 11 bytes

When using the database time zone, use the reply time zone.

INTERVAL [(Year_precision)] to MONTH

5 bytes

Contains the time interval type for the year and month. Year_precision is the number of digits in the year field, which defaults to 2 and is preferable to 0 to 9.

INTERVAL Day [(day_precision)]

To SECOND [(fractional_seconds_precision)]

11 bytes

Day_precision is the number of digits in the month field, which defaults to 2 and is preferable to 0 to 9.

  4, large object type: Store Big Data objects, such as audio, video and other formats.

Data type

Length

Description

Blob

Maximum (4gb-1) * Database block size

Storage of unstructured binaries. Supports transactional processing.

Clob

Maximum (4gb-1) * Database block size

Stores single-byte or multibyte-character data. Supports transactional processing.

NCLOB

Maximum (4gb-1) * Database block size

Stores Unicode data. Supports transactional processing.

BFILE

Maximum of 2 32-1 bytes

The LOB address points to a binary file on the file system, maintaining the directory and file name. Do not participate in transaction processing. Only read-only operations are supported.

  5. Other types:

Data type

Length

Description

LONG

Maximum of 2GB

Variable-length type, which stores strings. Do not use this type when creating a table.

RAW (N)

The maximum is 2000 bytes, n is the number of bytes, and n must be specified

Variable-length type, which does not change the value when the character set changes.

LONG RAW

Maximum of 2GB

Variable-length types, not recommended, are recommended for conversion to BLOB types, and do not change values when the character set changes.

ROWID

10 bytes

Represents the address of the record. A string that is displayed as a 18-bit. A relative unique address value that is used to locate a record in the database. Typically, this value is determined and unique when the row of data is inserted into a database table.

Oracle Base data types

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.