Oracle ALTER TABLE modify column Syntax example__oracle

Source: Internet
Author: User

Http://dba-oracle.com/t_alter_table_modify_column_syntax_example.htm

For complete tips on Oracle ALTER TABLE syntax, click Easy Oracle Jumpstart. Oracle provides "ALTER TABLE" syntax to modify data columns In-place in this form:

ALTER TABLE
table_name
Modify
COLUMN_NAME datatype;

If you are are brave can use a single "ALTER TABLE" syntax to modify multiple columns:

ALTER TABLE
table_name
Modify
(
Column1_name Column1_datatype,
Column2_name Column2_datatype,
Column3_name Column3_datatype,
Column4_name Column4_datatype
);

Here is are some examples of Oracle "ALTER TABLE" syntax to modify data columns and, you can add constraints like NO T NULL:

ALTER TABLE
Customer
MODIFY
(
Cust_name VARCHAR2 (m) not NULL,
Cust_hair_color VARCHAR2 (20)
)
;

We can also use Oracle ' ALTER TABLE ' syntax in dynamic pl/sql to modify data columns

BEGIN
SQL_STRING := 'ALTER TABLE '||:TABLE_NAME||' MODIFY '||:COLUMN_NAME||' VARCHAR2(100)';  . . .
END;

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.