Data types in Oracle

Source: Internet
Author: User

1 Basic data types

1) The numeric type number numbers can be formatted numerically by P,s. p denotes precision, which refers to the number of all valid digits in a numeric value. The parameter S represents the scale range, which represents the number of decimal places to the right.

such as Num_money number (9,2);

2) character type varchar2,char,long,nchar,nvarchar2 and so on. The VARCHAR2 is used to store variable-length strings. The maximum length is 4000 bytes. The char type represents a string of the specified length. char (maxlength)

MaxLength represents the maximum length of characters that can be stored. The default maximum length for a char type is 1 bytes. A long type represents a mutable string.

3) The date type has only a single date type. Storage space is 7 bytes of storage century, year, month, day, hour, minute, second

4) Boolean type its variable value can be true,false, or null.

2 Special data types

The 1%type type can declare a data type that is the same as the specified column name. For example declare Var_job emp.job%type; The data type of the emp.job is varchar (20), so the data type of var_job is also varchar (20), and the benefit is 1 you do not have to look at the data types of the columns in the table to ensure that the variables you define can store the retrieved data. 2 If you modify the data types that are already in the table, you do not have to consider type changes to the defined variables. Variables of type%type are automatically adjusted according to the actual type of the column.

Data types in Oracle

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.