Oracle table management

Source: Internet
Author: User
There are four specifications 1 must start with a letter 2 length cannot exceed 30 characters 3 cannot use ORACLE reserved words 4 can only use the following characters A-Z, a-z, 0-9, $, # and so on. the fixed length of a character CHAR cannot exceed 2000 characters. Example: Put the first four characters of CHAR (10) Xiaohan into Xiaohan, and then add 6 null supplements. VARCHAR2 (20) is a string of up to 4000 characters. Example: VARCHAR2 (10)

There are four specifications 1 must start with a letter 2 length cannot exceed 30 characters 3 cannot use ORACLE reserved words 4 can only use the following characters A-Z, a-z, 0-9, $, # and so on. the fixed length of a character CHAR cannot exceed 2000 characters. Example: Put the first four characters of CHAR (10) Xiaohan into Xiaohan, and then add 6 null supplements. VARCHAR2 (20) is a string of up to 4000 characters. Example: VARCHAR2 (10)

There are four specifications
<1> it must start with a letter.
<2> the length cannot exceed 30 characters
<3> ORACLE reserved words cannot be used.
<4> only A-Z, a-z, 0-9, $, # and so on can be used.
Character Type
The CHAR length cannot exceed 2000 characters.
Example: Put the first four characters of CHAR (10) "Xiaohan" into "Xiaohan", and then add 6 spaces to complete.
VARCHAR2 (20) is a string of up to 4000 characters.
Example: VARCHAR2 (10) 'Han 'oracle is allocated with 4 characters. This saves space.
The maximum size of a CLOB complex object is 4 GB.

In character type, the query speed of char type is the fastest, because it is fixed length and can be matched together for comparison.
Number Type
The value ranges from 10 to 38 to the power of 10.
NUMBER (5, 2) indicates that there are five valid digits, two decimal places. Value Range:-999.99 999.99
NUMBER (5) indicates a five-digit integer. Value Range:-99999 99999
Date type
DATE
TIMESTAMP (TIMESTAMP) ORACLE 9i extension of the DATE data type.

Image
BLOB binary data can store pictures/sounds for 4 GB.

Modify Field Length

Alter table student modify (xm varchar2 (30 ));

Modify the type or name of a field (data is not allowed ).
Alter table student MODIFY (xm CHAR (30 ));
Delete a field.
Alter table student drop column sal;
Modify the table name.
RENAME student TO stu;
Delete table
Drop table student;

Modify the default format of a date

Alter session set nls_date_format = 'yyyy-mm-dd ';


Set save point
SAVEPOINT
Rollback to save the vertex name

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.