Oracle Study Notes: analyze various data types

Source: Internet
Author: User

According to my recent study on Oracle databases, I have learned more about Oracle and hope to help some new Oracle users.

Oracle provides several simple data types, Unlike SQL server. Common Oracle data types include char, varchar2, clob, number, Date, timestamp, blob, and other common data types.

Char (num) is a fixed length of up to 2000 characters. The query efficiency of char is extremely high. However, if char is used, the length of the character is not automatically recognized and how many characters are defined, it will take up to a few characters, even if the stored characters are only two, and the defined char is four characters, it will fill the last two characters with spaces.

Varchar2 (num) is an upgraded version of varchar. Oracle has optimized varchar2. The difference between VARCHAR and VARCHAR2 is that varchar2 treats null strings as null strings. The maximum length of varchar2 is 4000 characters, and varchar2 can save characters. The difference is that varchar2 recognizes the length of stored characters and does not occupy extra space. However, the query efficiency is not as high as char. As for a VARCHAR2 character to use several bytes to store, to see the character set used by the database, such as GBK, Chinese characters will occupy two bytes, one English, if it is UTF-8, Chinese characters generally occupy three bytes, english or 1.

The maximum clob volume object, which can store 4 GB of capacity.

Number is a data type. If only number is defined, it indicates an integer. If number () is defined, it indicates 7 valid numbers with two decimal places, for example, the number 12345.67 conforms to the number () Definition. Number ranges from-(Power 38 of 10) to power 38 of 10.

Date data type, including year, month, day, hour, minute, and second.

Timestamp is an extension of the date type and is a more precise time data type, which is generally not used.

Blob binary data, which can store images, videos, and other resources, up to 4 GB.

Oralce also has other less useful types, such as long and nvarchar2 () [variable-length strings based on character sets. If you are interested, you can continue your research and share the research results with me.

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.