Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

oracle 10g»ù´¡²Ù×÷±í

¡¡¡¡1´´½¨Ð±í
¡¡¡¡1.1´Ó²éѯµ½µÄ±í´´½¨±í
¡¡¡¡create table temp as select stuName,stuNo,stuSex from stuInfo where stuAge>25;
¡¡¡¡1.2´´½¨Ð±í
¡¡¡¡/*ѧÉúÐÅÏ¢±í*/
¡¡¡¡create table stuInfo(
¡¡¡¡stuName varchar2(10) ,
¡¡¡¡stuNo varchar2(10),
¡¡¡¡stuSex varchar2(4),
¡¡¡¡stuAge number(2),
¡¡¡¡stuSeat number(10),
¡¡¡¡stuAddress varchar2(400));
¡¡¡¡/*ѧÉú³É¼¨±í*/
¡¡¡¡create table stuMark(
¡¡¡¡examNo varchar2(10),
¡¡¡¡stuNo varchar2(10),
¡¡¡¡writtenExam number(4),
¡¡¡¡labExam number(4));
¡¡¡¡2 Ð޸ıí
¡¡¡¡2.1 Ôö¼Ó×Ö¶Î
¡¡¡¡alter table stuInfo add(Zip number(6));
¡¡¡¡2.2 ɾ³ý×Ö¶Î
¡¡¡¡alter table stuInfo drop column Zip
¡¡¡¡2.3 ÐÞ¸Ä×Ö¶ÎÀàÐÍ
¡¡¡¡alter table stuInfo modify(Zip varchar2(6));
¡¡¡¡2.4ÐÞ¸Ä×ֶδóС
¡¡¡¡alter table stuInfo modify(Zip number(4));
¡¡¡¡2.5 ɾ³ý±í
¡¡¡¡drop table stuInfo
¡¡¡¡3Ô¼Êø
¡¡¡¡3.1Ìí¼ÓÔ¼Êø
¡¡¡¡alter table stuInfo add constraint PK_stuNo primary key(stuNo);
¡¡¡¡alter table stuInfo add constraint CK_stuSex check(stuSex in('ÄÐ','Å®'));
¡¡¡¡alter table stuInfo add constraint CK_stuAge check(stuAge between 15 and 40);
¡¡¡¡alter table stuInfo add constraint CK_stuSeat check(stuSeat between 1 and 30);
¡¡¡¡alter table stuMark add constraint PK_ExamNo_stuMark  primary key(examNo);
¡¡¡¡alter table stuMark add constraint FK_stuNo_stuMark  foreign key(stuNo) references stuInfo(stuNo);
¡¡¡¡select stuName,decode(stuSex,'ÄÐ','ÄÐͬ־'),
¡¡¡¡(stuSex,'Å®','Ůͬ־')
¡¡¡¡from stuInfo;
¡¡¡¡alter table stuInfo modify(stuSex not null);
¡¡¡¡3.2ɾ³ýÔ¼Êø
¡¡¡¡3.2.1ɾ³ýÆÕͨԼÊø
¡¡¡¡alter table stuInfo drop constraint CK_stuSex;
¡¡¡¡3.2.2ɾ³ý±»Íâ¼ü²ÎÕÕµÄÖ÷¼üÔ¼Êø
¡¡¡¡alter table stuInfo drop primary key PK_StuNo
¡¡¡¡4Ë÷Òý
¡¡¡¡4.1´´½¨Ë÷Òý
¡¡¡¡create index stuName_index on stuInfo(stuName);
¡¡¡¡4.2ɾ³ýË÷Òý
¡¡¡¡drop index stuName_index;
¡¡¡¡5´´½¨ÐòÁÐ
¡¡¡¡5.1 ´´½¨ÐòÁÐ
¡¡¡¡create sequence stuSeat_identity
¡¡¡¡minvalue 1
¡¡¡¡maxvalue 99999999
¡¡¡¡start with 1
¡¡¡¡increment by 1
¡¡¡¡cache 2
¡¡¡¡5.2´¥·¢Æ÷ʵÏÖ×Ö¶ÎÁÐ×ÔÔö³¤


Ïà¹ØÎĵµ£º

Oracle ¸ôÀ뼶±ð

¸ôÀ뼶±ð£¨isoation level£©
 
¸ôÀ뼶±ð¶¨ÒåÁËÊÂÎñÓëÊÂÎñÖ®¼äµÄ¸ôÀë³Ì¶È¡£
¸ôÀ뼶±ðÓë²¢·¢ÐÔÊÇ»¥ÎªÃ¬¶ÜµÄ£º¸ôÀë³Ì¶ÈÔ½¸ß£¬Êý¾Ý¿âµÄ²¢·¢ÐÔÔ½²î£»¸ôÀë³Ì¶ÈÔ½µÍ£¬Êý¾Ý¿âµÄ²¢·¢ÐÔÔ½ºÃ¡£
 
ANSI/ISO SQ92±ê×¼¶¨ÒåÁËһЩÊý¾Ý¿â²Ù×÷µÄ¸ôÀ뼶±ð£º
δÌá½»¶Á£¨read uncommitted£©
Ìá½»¶Á£¨read committed£© &n ......

Oracle»Ö復ÒâÍâ刪³ýµÄ數據

 1. flashback table table_test to timestamp to_timestamp('20091103000000','yyyymmddhh24miss');
 2.Èç¹û報錯ORA-08189: cannot flashback the table because row movement is not enabled
 3.alter table table_test enable row movement;
 4.OK ......

Oracle Shrink Table


´Ó10g¿ªÊ¼£¬oracle¿ªÊ¼ÌṩShrinkµÄÃüÁ¼ÙÈçÎÒÃǵıí¿Õ¼äÖÐÖ§³Ö×Ô¶¯¶Î¿Õ¼ä¹ÜÀí (ASSM),¾Í¿ÉÒÔʹÓÃÕâ¸öÌØÐÔËõС¶Î£¬¼´½µµÍHWM¡£ÕâÀïÐèҪǿµ÷Ò»µã£¬10gµÄÕâ¸öÐÂÌØÐÔ£¬½ö¶ÔASSM±í¿Õ¼äÓÐЧ£¬·ñÔò»á±¨ ORA-10635: Invalid segment or tablespace type¡£ 
Èç¹û¾­³£ÔÚ±íÉÏÖ´ÐÐDML²Ù× ......

oracle ±Ê¼Ç VI Ö®Óαê (CURSOR)

 Óαê(CURSOR),ºÜÖØÒª
Óαê:ÓÃÓÚ´¦Àí¶àÐмǼµÄÊÂÎñ
ÓαêÊÇÒ»¸öÖ¸ÏòÉÏÏÂÎĵľä±ú(handle)»òÖ¸Õë,¼òµ¥Ëµ£¬Óαê¾ÍÊÇÒ»¸öÖ¸Õë
1 ´¦ÀíÏÔʽÓαê
  ÏÔʽÓα괦ÀíÐè 4¸ö PL/SQL ²½Öè,ÏÔʾÓαêÖ÷ÒªÓÃÓÚ´¦Àí²éѯÓï¾ä
  (1) ¶¨ÒåÓαê
  ¸ñʽ:  CURSOR cursor_name [(partment[,parameter]...)] IS s ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ