ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

Oracle±íµÄ´´½¨¼°Ïà¹Ø²ÎÊý(¶þ)
2015-07-24 10:58:11 À´Ô´: ×÷Õß: ¡¾´ó ÖРС¡¿ ä¯ÀÀ:5´Î
Tags£ºOracle ´´½¨ Ïà¹Ø ²ÎÊý
XT 1024K PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 5) TABLESPACE exampletb 2¡¢ Ð޸ıí½á¹¹ Alter table ±íÃû add (ÁÐÃû ÀàÐÍ); --Ìí¼ÓÐÂÁÐ Alter table ±íÃû modify (ÁÐÃû ÀàÐÍ); --ÐÞ¸ÄÁж¨Òå Alter table ±íÃû drop column ÁÐÃû; --ɾ³ýÁÐ Rename ±íÃû to бíÃû --¸Ä±íÃû£¨±íÃûǰ²»Äܼӷ½°¸Ãû£© ALTER TABLE ±íÃû RENAME COLUMN µ±Ç°ÁÐÃû TO ÐÂÁÐÃû; --ÐÞ¸ÄÁÐÃû ? Ð޸ıí½á¹¹°¸Àý SQL> Alter table scott.student add (QQ number(10)); --Ϊstudent±íÔö¼ÓÁдæ·ÅQQºÅ SQL> Alter table scott.student modify (QQ number(12)); --ÐÞ¸Ästudent±íÖÐÃûΪQQµÄÁÐ SQL> Alter table scott.student rename COLUMN QQ to QQ_num; --½«student±íÖÐÃûΪQQµÄÁиÄÃûQQ_num SQL> Alter table scott.student drop column QQ_num; --ɾ³ýstudent±íÖÐÃûΪQQ_numµÄÁÐ SQL> insert into scott.student(id,name) values(1, 'lucy'); --Ïòstudent±íÖвåÈëÒ»Ìõ¼Ç¼ SQL> Alter table scott.student modify (sex char(1) default 'M'); --ÐÞ¸ÄsexÁе͍Òå SQL> insert into scott.student(id,name) values(2, 'Dell'); --Ïòstudent±íÖвåÈëÒ»Ìõ¼Ç¼ SQL> Alter table scott.student modify (sex char(1) default null); --ÐÞ¸ÄsexÁе͍Òå SQL> insert into scott.student(id,name) values(3, 'Mary'); --Ïòstudent±íÖвåÈëÒ»Ìõ¼Ç¼ ˼¿¼£ºoracleÖÐÁеÄĬÈÏÖµÉèÖÃÓëÐ޸ġ£ 3¡¢ ±íµÄÔ¼Êø Alter table ±íÃû add constraint Ô¼Êø ; --Ôö¼ÓÒ»¸öÔ¼Êø Alter table ±íÃû drop constraint Ô¼ÊøÃû; --ɾ³ýÒ»¸öÔ¼Êø alter table±íÃûenable [validate/novalidate] constraintÔ¼ÊøÃû; --ÆôÓÃÒ»¸öÔ¼Êø£¬validate/novalidate´ú±íÆôÓÃÔ¼ÊøÊ±ÊÇ·ñ¶Ô±íÖÐÔ­ÓÐÊý¾Ý×÷¼ì²é¡£ alter table±íÃûdisable constraintÔ¼ÊøÃû; --½ûÓÃÒ»¸öÔ¼Êø ? Ð޸ıíÔ¼Êø°¸Àý SQL> Alter table scott.student disable constraint st_sex_ck; --½ûÓÃst_sex_ckÔ¼Êø SQL> insert into scott.student(id,name,sex) values(4, 'Lily', 'N'); SQL> Alter table scott.student enable novalidate constraint st_sex_ck; --ÆôÓÃst_sex_ckÔ¼Êø£¬µ«²»¼ì²éÒÑÓÐÊý¾Ý¡£ SQL> select * from scott.student; SQL> insert into scott.student(id,name,sex) values(5, 'Mark', 'N'); SQL>@$ORACLE_HOME/rdbms/admin/utlexpt1.sql --½¨Á¢Òì³£Êý¾Ý±£´æ±í »òÕß @ G:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlexpt1.sql --¾ßÌå·¾¶¿ÉÒÔͨ¹ýËÑË÷utlexpt1.sql»ñÈ¡ SQL>alter table scott.student enable validate constraint st_sex_ck exceptions into exceptions; -- ½«Òì³£Êý¾Ý×°ÈëÒì³£±í SQL> select * from scott.student where rowid in(select row_id from exceptions); --²é¿´¶ÔÓ¦µÄÔ­±íÖеÄÒì³£Êý¾Ý SQL>Alter table scott.student drop constraint st_sex_ck; --ɾ³ýÔ¼Êøst_sex_ck
Ê×Ò³ ÉÏÒ»Ò³ 1 2 ÏÂÒ»Ò³ βҳ 2/2/2
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
·ÖÏíµ½: 
ÉÏһƪ£ºoracle12cѧϰ֮ÈýpdbµÄ¿É°Î²å²âÊÔ ÏÂһƪ£ºoracle¶àÐкϲ¢³ÉÒ»ÐÐ

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

¡¤Linuxϵͳ¼ò½é (2025-12-25 21:55:25)
¡¤Linux°²×°MySQL¹ý³Ì (2025-12-25 21:55:22)
¡¤Linuxϵͳ°²×°½Ì³Ì£¨ (2025-12-25 21:55:20)
¡¤HTTP Åc HTTPS µÄ²î„ (2025-12-25 21:19:45)
¡¤ÍøÕ¾°²È«±ØÐ޿ΣºÍ¼ (2025-12-25 21:19:42)