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

Oracle select in/exists/not in/not exits

in ÊǰÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ­»·£¬Ã¿´ÎloopÑ­»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊǰÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ­»·£¬Ã¿´ÎloopÑ­»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£ Èç¹ûÁ½¸ö±íÖÐÒ»¸ö½ÏС£¬Ò»¸öÊÇ´ó±í£¬Ôò×Ó²éѯ±í´óµÄÓÃexists£¬×Ó²éѯ±íСµÄÓÃin£º ÀýÈ磺±íA£¨Ð¡±í£©£¬±íB£¨´ó±í£©
1£º
select * from A where cc in (select cc from B)
ЧÂʵͣ¬Óõ½ÁËA±íÉÏccÁеÄË÷Òý£»
select * from A where exists(select cc from B where cc=A.cc)
ЧÂʸߣ¬Óõ½ÁËB±íÉÏccÁеÄË÷Òý¡£
Ïà·´µÄ
2£º
select * from B where cc in (select cc from A)
ЧÂʸߣ¬Óõ½ÁËB±íÉÏccÁеÄË÷Òý£»
select * from B where exists(select cc from A where cc=B.cc)
ЧÂʵͣ¬Óõ½ÁËA±íÉÏccÁеÄË÷Òý¡£
not in ºÍnot exists
Èç¹û²éѯÓï¾äʹÓÃÁËnot in ÄÇôÄÚÍâ±í¶¼½øÐÐÈ«±íɨÃ裬ûÓÐÓõ½Ë÷Òý£»
¶ønot extsts µÄ×Ó²éѯÒÀÈ»ÄÜÓõ½±íÉϵÄË÷Òý¡£
ËùÒÔÎÞÂÛÄǸö±í´ó£¬ÓÃnot exists¶¼±Ènot inÒª¿ì¡£ in Óë =µÄÇø±ð select name from student where name in ('zhang','wang','li','zhao'); Óë select name from student where name='zhang' or name='li' or name='wang' or name='zhao' µÄ½á¹ûÊÇÏàͬµÄ¡£
-----------------------------------------------------------------ʵÀý
--µÇ½gather/123456@pc150 Ö´ÐÐÒÔÏÂÓï¾ä£¬×¢ÒâÖ´ÐÐʱ¼ä
---С±í
er_street_code
select distinct tt.gkdm from er_street_code tt where tt.gkdm is not null
---´ó±í
er_in_detail,er_reck_detail ---Àý1
select * from er_reck_detail t1 where t1.gkdm in (select gg.gkdm from er_street_code gg) select * from er_reck_detail t1 where exists (select * from er_street_code gg where t1.gkdm=gg.gkdm) ---Àý2
select * from er_street_code aa where aa.gkdm in (select mm.gkdm from er_reck_detail mm) select * from er_street_code aa where exists (select * from er_reck_detail


Ïà¹ØÎĵµ£º

oracleÇ¨ÒÆ±í¿Õ¼ä

¿ÉÇ¨ÒÆ±í¿Õ¼ätransport tablespace
¿ÉÇ¨ÒÆ±í¿Õ¼ä
ʹÓÿÉÇ¨ÒÆ±í¿Õ¼ä(Transportable Tablespaces)µÄÌØÐÔÔÚÊý¾Ý¿âÖ®¼äÒÆ¶¯´óÁ¿Êý¾Ý£¬ÐÔÄܱÈexport/importºÍunload/loadÒª¿ìºÜ¶à£¬ÒòΪËüÇ¨ÒÆ±í¿Õ¼äÖ»ÐèÒª¸´ÖÆÊý¾ÝÎļþºÍ²åÈë±í¿Õ¼äÔªÊý¾Ýµ½Ä¿±êÊý¾Ý¿âÖС£
Ç¨ÒÆ±í¿Õ¼ä¶ÔÒÔÏÂÓ¦ÓÃÌØ±ðÓÐÓãº
·Ö½×¶Î½«OLTPµÄÊý¾ÝÒÆÈëÊý¾Ý²Ö¿â
¸ ......

ORACLE¼¸¸ö¹ýÂËÌõ¼þµÄÖ´ÐÐ˳Ðò

select distinct id
  from table t
 where rownum < 10
 order by t.id desc;
ÉÏÊöÓï¾äµÄ¹ýÂËÌõ¼þÖ´ÐÐ˳Ðò ÏÈwhere --->order by --->distinct
Èç¹ûÓÐgroup byµÄ»° group by ÔÚorder byÇ°ÃæµÄ ......

oracle 10g¿Í»§¶Ëµ¼³ö11gÓû§µÄÍêÕûÊý¾Ý

     ΪÁË×öÐéÄâ»ú£¬ÐèÒª½«·þÎñÆ÷ÉϵÄ11gµÄÓû§µÄÍêÕûÊý¾Ýµ¼³öÀ´¡£¶øÐéÄâ»úÉϵÄoracle10gµÄ£¬Ö±½Óµ¼³öÀ´£¬ÎÞ·¨µ¼Èëµ½ÐéÄâ»ú¡£
ËùÒÔ£¬ÊÔ×ÅÓÃ10gµÄ¿Í»§¶ËÀ´µ¼³öÊý¾Ý£¬
ÓÃÃüÁî:exp exoa/*****@exoa1 file=20100526.dmp grants=y full=y
Ö´Ðкó£¬ÏµÍ³Ìáʾ£º
  EXP-00008:Óöµ½ ORACLE´íÎó1406
&nb ......

oracle Ö÷¼ü \Ë÷Òý


ÔÚoracleÖУ¬ÎÒÃÇ´´½¨Ò»¸öÖ÷¼ü£¬Ôòͬʱ×Ô¶¯´´½¨ÁËÒ»¸öͬÃûµÄΨһË÷Òý£»É¾³ýÖ÷¼ü£¬ÔòÖ÷¼üÔ¼ÊøºÍ¶ÔÓ¦µÄΨһË÷Òý¶¼É¾³ýÁË¡£ÕâÊÇÎÒÃǾ­³£¼ûµ½µÄÏÖÏó¡£
 
·¢³öÒ»¸ö´´½¨Ö÷¼üµÄsql£¬oracleÆäʵִÐÐÁËÁ½²½£º´´½¨Ö÷¼üÔ¼Êø¡¢´´½¨/¹ØÁª ΨһË÷Òý¡£²½ÖèÊÇÕâÑùµÄ£º
´´½¨Ö÷¼üÔ¼ÊøÊ±£¬¼ì²é¸ÃÖ÷¼ü×Ö¶ÎÉÏÊÇ·ñÒѾ­´æÔÚΨһË÷Òý¡£Èô² ......

Oracle Êý¾ÝÀàÐÍ·ÖÏí

¸øÍŶÓÄÚ²¿×öµÄÒ»¸öOracle Êý¾ÝÀàÐÍ·ÖÏí£¬Ö÷ÒªÊǹØÓÚOracleÊý¾ÝÀàÐÍһЩÄÚ²¿´æ´¢½á¹¹¼°ÐÔÄܽéÉÜ¡£
 http://www.slideshare.net/yzsind/oracle-4317768
ÒÔÏÂÊÇPPTÖÐunDumpNumberº¯ÊýµÄÈ«²¿´úÂ룺
 
create or replace function unDumpNumber(iDumpStr varchar2) return number is
 
  TYPE ByteAr ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ