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

ORACLEÖÐin ºÍ existsÇø±ð

INºÍEXISTSÇø±ð
in ÊǰÑÍâ±íºÍÄÚ±í×÷hash join£¬¶ø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ÁеÄË÷Òý¡£
´øinµÄ¹ØÁª×Ó²éѯÊǶàÓàµÄ£¬ÒòΪin×Ó¾äºÍ×Ó²éѯÖÐÏà¹ØµÄ²Ù×÷µÄ¹¦ÄÜÊÇÒ»ÑùµÄ¡£È磺
select staff_name from staff_member where staff_id in
 (select staff_id from staff_func where staff_member.staff_id=staff_func.staff_id);
Ϊ·Ç¹ØÁª×Ó²éѯָ¶¨exists×Ó¾äÊDz»Êʵ±µÄ£¬ÒòΪÕâÑù»á²úÉúµÑ¿¨³Ë»ý¡£È磺
select staff_name from staff_member where staff_id
exists (select staff_id from staff_func);
not in ºÍnot exists
Èç¹û²éѯÓï¾äʹÓÃÁËnot in ÄÇôÄÚÍâ±í¶¼½øÐÐÈ«±íɨÃ裬ûÓÐÓõ½Ë÷Òý£»
¶ønot extsts µÄ×Ó²éѯÒÀÈ»ÄÜÓõ½±íÉϵÄË÷Òý¡£
ËùÒÔÎÞÂÛÄĸö±í´ó£¬ÓÃnot exists¶¼±Ènot inÒª¿ì¡£
¾¡Á¿²»ÒªÊ¹ÓÃnot in×Ӿ䡣ʹÓÃminus ×Ӿ䶼±Ènot in ×Ó¾ä¿ì£¬ËäȻʹÓÃminus×Ó¾äÒª½øÐÐÁ½´Î²éѯ£º
select staff_name from staff_member where staff_id in (select staff_id from staff_member minus select staff_id from staff_func where func_id like '81%');
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'
µÄ½á¹ûÊÇÏàͬµÄ¡£


Ïà¹ØÎĵµ£º

connect by prior Ò»¸öºÜºÃÓõÄORACLEµÝ¹éÓï¾ä

select t.*, t.rowid from indicators t start with (t.isleaf='1' and t.rid='26020')
connect by prior t.pid = t.id order by t.inum
´ÓÒ¶×Ó½ÚµãÒÀ¾Ýid=pidµÄ¹ØÏµÏòÉϵݹ鵽¸ú½Úµã¡£
select t.*, t.rowid from indicators t start with (t.pid='0' and t.rid='26020')
connect by prior t.id = t.pid order by t.i ......

OracleÊý¾Ý¿â×Ô¶¨ÒåÒì³£µÄʹÓ÷½·¨

 À´Ô´£º²»Ïê  ×÷ÕߣºØýÃû  Ê±¼ä£º2009-9-6 17:14:04 Tags£º Orac ʹÓ÷½·¨
ÐèÇó£ºÒµÎñÂß¼­ÔÚ´¦ÀíÊý¾Ýʱ£¬ÐèÒª·µ»ØMessage²¢×èÖ¹³ÌÐòµÄ¼ÌÐøÔËÐС£µ«ÊÇ£¬ÔÚ´æ´¢¹ý³ÌʹÓÃOracleÊý¾Ý¿âµÄRaise¸ù±¾ÎÞ·¨Âú×ãÏÖÔÚµÄÒªÇó¡£
½â¾ö·½·¨£º
ʹÓÃRAISE_APPLICATION_ERROR
RAISE_APPLICATION_ERROR ( erro ......

oracle ÅÅÐòÄÚ´æ

ÎÒÔÚhttp://zhidao.baidu.com/question/123262452.html?fr=msg¡¡ÌáµÄÎÊÌ⣬ÕûÀíµ½ÕâÀï¡¡·Ç³£¸Ðл zjwssg
µÄ»Ø´ð
ÅÅÐòÄÚ´æÉæ¼°µ½PGA¡£
ʲôʱºòʹÓÃ×Ô¶¯PGAÄÚ´æ¹ÜÀí£¿Ê²Ã´Ê±ºòʹÓÃÊÖ¶¯PGAÄÚ´æ¹ÜÀí£¿
  °×ÌìϵͳÕý³£ÔËÐÐʱÊʺÏʹÓÃ×Ô¶¯PGAÄÚ´æ¹ÜÀí£¬ÈÃOracle¸ù¾Ýµ±Ç°¸ºÔØ×Ô¶¯¹ÜÀí¡¢·ÖÅäPGAÄÚ´æ¡£
  Ò¹ÀïÓû§Êý ......

Oracle Dimension £¨Oracle ά£©

 
ÔÚÊý¾Ý²Ö¿â»·¾³ÖУ¬ÎÒÃÇͨ³£ÀûÓÃÎﻯÊÓͼǿ´óµÄ²éÑ¯ÖØÐ´¹¦ÄÜÀ´ÌáÉýͳ¼Æ²éѯµÄÐÔÄÜ£¬µ«ÊÇÎﻯÊÓͼµÄ²éÑ¯ÖØÐ´¹¦ÄÜÓÐʱºòÎÞ·¨ÖÇÄܵØÅжϲéѯÖÐһЩÏà¹ØÁªµÄÌõ¼þ£¬ÒÔÖÁÓÚÓ°ÏìÐÔÄÜ¡£±ÈÈçÎÒÃÇÓÐÒ»ÕÅÏúÊÛ±ísales£¬ÓÃÓÚ´æ´¢¶©µ¥µÄÏêϸÐÅÏ¢£¬°üº¬½»Ò×ÈÕÆÚ¡¢¹Ë¿Í±àºÅºÍÏúÊÛÁ¿¡£ÎÒÃÇ´´½¨Ò»ÕÅÎﻯÊÓͼ£¬°´Ô´洢ÀÛ¼ÆÏúÁ¿ÐÅÏ¢£¬¼ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ