Oracle ALTER Command Encyclopedia ____oracle

Source: Internet
Author: User

Create table user (    id    number (3),      USERNAME VARCHAR2 (    PASSWORD VARCHAR2),      Cid  number (3),     sex varcher (4)); Create table card (    id number (3),     name  VARCHAR2 (10)); --Add primary key Alter table user add constraint uaer_pk primary key (ID); --Add foreign Key Alter table user add constraint uaer_fk foreign key (CID)   References card (ID); --Add Check constraint alter table user add constraint uaer_chk check  (sex in ) (' Boy ', ' Girl ')); ---------------\ \ Operation Column alter table tablename add  (columnname datatype[default value ][null/not null],......); --Add Column alter table tablename modify (columnname datatype[default vAlue][null/not null],......); --Modify Column Alter table tablename drop (ColumnName);--Delete Column Alter table tablename rename  column col_old_name to col_new_name;--Modify Column Name--add column alter table user add (AA  varchar2  default  ' aaaa '  not null); --Modifying column alter table user modify (USERNAME VARCHAR2 (1000)); --Delete column alter table user drop (password); --Modify Column name alter table user rename column username to username_new; ----------------\ \ Compile the specified object:    process:     alter procedure procedure_name  compile;    function:     alter function funtion_name compile;    Package:     alter package package_name compile;    Package Body:     alter package package_name compile body; ----------------\ \ Move the index to the T_IDX Index table space alter index user_pk rebuild tablespace t_idx; \ \ Create path create or replace directory dir_cust as  '/oracle/aaa '; \ \ Move the table to the tb_t table space alter table user move tablespace tb_t---------------------------------- -------------------------\ \ Main foreign key effective failure Alter table user disable constraint uaer_pk ; Alter table user enable constraint uaer_pk ; \ \ Trigger Invalid alter table user disable all triggers; alter table user enable all triggers; \ Unlock alter user zzz account unlock;

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.