Home > Database > Mysql Tutorial > body text

What are the common data types in Oracle database?

WBOY
Release: 2024-03-08 09:15:03
Original
821 people have browsed it

What are the common data types in Oracle database?

There are many common data types in Oracle database, including numeric type, character type, date type, etc. Some common data types will be introduced in detail below, with corresponding code examples.

  1. Numerical data type:
  2. NUMBER: Used to store numeric type data, and the precision and range can be specified as needed.
    Example: CREATE TABLE test_table (
    id NUMBER(10),
    salary NUMBER(8,2)
    );
  • INTEGER: used for storage Integer type data.
    Example: CREATE TABLE test_table (
    id INTEGER,
    age INTEGER
    );
  1. Character data type:
  2. VARCHAR2: Used to store variable-length character data, with a maximum length of 4000 bytes.
    Example: CREATE TABLE test_table (
    name VARCHAR2(50),
    address VARCHAR2(100)
    );
  • CHAR: used to store fixed length Character data, the missing part will be filled with spaces.
    Example: CREATE TABLE test_table (
    code CHAR(5),
    status CHAR(10)
    );
  1. Date data type:
  2. DATE: Used to store date and time data.
    Example: CREATE TABLE test_table (
    hire_date DATE,
    birth_date DATE
    );
    ##TIMESTAMP: used to store date, time and time zone information.
  • Example: CREATE TABLE test_table (
    order_time TIMESTAMP,
    delivery_time TIMESTAMP
    );
    Other common data types:
  1. CLOB: Used to store large amounts of text data.
  2. Example: CREATE TABLE test_table (
    description CLOB
    );
    BLOB: used to store large amounts of binary data.
  • Example: CREATE TABLE test_table (
    image BLOB
    );
The above are common data types and their code examples in Oracle database. Different data types are suitable for different For data storage requirements, you can choose the appropriate data type to create a database table according to the actual situation.

The above is the detailed content of What are the common data types in Oracle database?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template