ORACLE ÖÐINºÍEXISTSµÄÇø±ð
ÔÎĵØÖ·£ºhttp://www.cnblogs.com/yf520gn/archive/2009/01/12/1374359.html
EXISTSµÄÖ´ÐÐÁ÷³Ì
select * from t1 where exists ( select null from t2 where y = x )
¿ÉÒÔÀí½âΪ:
for x in ( select * from t1 )
loop
if ( exists ( select null from t2 where y = x.x )
then
OUTPUT THE RECORD
end if
end loop
¶ÔÓÚin ºÍ existsµÄÐÔÄÜÇø±ð:
Èç¹û×Ó²éѯµÃ³öµÄ½á¹û¼¯¼Ç¼½ÏÉÙ£¬Ö÷²éѯÖеıí½Ï´óÇÒÓÖÓÐË÷ÒýʱӦ¸ÃÓÃin,·´Ö®Èç¹ûÍâ²ãµÄÖ÷²éѯ¼Ç¼½ÏÉÙ£¬×Ó²éѯÖеıí´ó£¬ÓÖÓÐË÷ÒýʱʹÓÃexists¡£
ÆäʵÎÒÃÇÇø·ÖinºÍexistsÖ÷ÒªÊÇÔì³ÉÁËÇý¶¯Ë³ÐòµÄ¸Ä±ä£¨ÕâÊÇÐÔÄܱ仯µÄ¹Ø¼ü£©£¬Èç¹ûÊÇexists£¬ÄÇôÒÔÍâ²ã±íΪÇý¶¯±í£¬Ïȱ»·ÃÎÊ£¬Èç¹ûÊÇIN£¬ÄÇôÏÈÖ´ÐÐ×Ó²éѯ£¬ËùÒÔÎÒÃÇ»áÒÔÇý¶¯±íµÄ¿ìËÙ·µ»ØΪĿ±ê£¬ÄÇô¾Í»á¿¼Âǵ½Ë÷Òý¼°½á¹û¼¯µÄ¹ØϵÁË
ÁíÍâINʱ²»¶ÔNULL½øÐд¦Àí
È磺
select 1 from dual where null in (0,1,2,null)
Ϊ¿Õ
2.NOT IN ÓëNOT EXISTS:
NOT EXISTSµÄÖ´ÐÐÁ÷³Ì
select .....
from rollup R
where not exists ( select 'Found' from title T
where R.source_id = T.Title_ID);
¿ÉÒÔÀí½âΪ:
for x in ( select * from rollup )
loop
if ( not exists ( that query ) ) then
OUTPUT
end if;
end;
×¢Òâ:NOT EXISTS Óë NOT IN ²»ÄÜÍêÈ«»¥ÏàÌæ»»£¬¿´¾ßÌåµÄÐèÇó¡£Èç¹ûÑ¡ÔñµÄÁпÉÒÔΪ¿Õ£¬Ôò²»Äܱ»Ìæ»»¡£
ÀýÈçÏÂÃæÓï¾ä£¬¿´ËûÃǵÄÇø±ð£º
select x,y from t;
x y
------ ------
1 3
3 1
1 2
1  
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
¶Ôºú²®ÁֵIJɷÃÈçÆÚÔÚλÓÚ±±¾©¹úóµÄOracleÖйú×ܲ¿½øÐУ¬µ±¼ÇÕß°Ñ×¼±¸ºÃµÄ²É·ÃÌá¸ÙµÝ¸øºú²®ÁÖÖ⣬ÒÔΪËû»áÏñÐí¶àÊÜ·ÃÕßÒ»ÑùÌÏÌϲ»¾øÆðÀ´£¬ËÖªËûÖ»ÊÇ¿´ÁËÒ»ÑÛ˵£º“»¹ÊÇÒ»ÆðÌÖÂÛ°É£¬Îҿɲ»Ô¸³ª¶À½ÇÏ·¡£”
¡¡¡¡ÔÚOracleÖйú£¬ºú²®ÁÖÊÇÒ»¸öÇÅÁº£¬Ò»¸öÓë×ܲ¿ÓëÖйúÔ±¹¤Ö®¼ä¹µÍ¨µÄÇÅÁº£¬Ò»¸öÕ½ÂÔÖƶ¨ÓëÖ´ÐÐÖ®¼äµÄÇÅ ......
ORACLE±¸·Ý²ßÂÔ(ORACLE BACKUP STRATEGY)
2007Äê11ÔÂ02ÈÕ ÐÇÆÚÎå 16:03
¸ÅÒª
1¡¢Á˽âʲôÊDZ¸·Ý
2¡¢Á˽ⱸ·ÝµÄÖØÒªÐÔ
3¡¢Àí½âÊý¾Ý¿âµÄÁ½ÖÖÔËÐз½Ê½
4¡¢Àí½â²»Í¬µÄ±¸·Ý·½Ê½¼°ÆäÇø±ð
5¡¢Á˽âÕýÈ·µÄ±¸·Ý²ßÂÔ¼°ÆäºÃ´¦
Ò»¡¢Á˽ⱸ·ÝµÄÖØÒªÐÔ
¿ÉÒÔ˵£¬´Ó¼ÆËã»úϵͳ³öÊÀµÄÄÇÌìÆ𣬾ÍÓÐÁ˱¸·ÝÕâ¸ö¸ÅÄ ......
ÔÚOracleÖв鿴ËùÓеıí:
select * from tab/dba_tables/dba_objects/cat;
¿´Óû§½¨Á¢µÄ±í :
select table_name from user_tables; //µ±Ç°Óû§µÄ±í
select table_name from all_tables; //ËùÓÐÓû§µÄ±í   ......
´¥·¢Æ÷¿ª·¢µÄÄ¿µÄ£ºÈ·±£Êý¾Ý¿âÂú×ãÌض¨µÄÉÌÒµ¹æÔòºÍÆóÒµÂß¼£¬¿ÉÒÔʹÓô¥·¢Æ÷£¬Ô¼Êø£¬×Ó³ÌÐò¡£ÒòΪ
Ô¼Êø×î¼òµ¥ÇÒÐÔÄܺã¬ËùÑ¡Ô¼Êø£¬Èç¹ûÔ¼Êø²»ÄÜÂú×㣬¾ÍÓô¥·¢Æ÷£¬Èô´¥·¢Æ÷¶¼²»ÄÜÂú×ãÑ¡Ôñ×Ó³ÌÐò¡£
Ò»¡¢´¥·¢Æ÷¹¦ÄÜ£º
1£¬¿ØÖÆÊý¾Ý°²È«,ÔÚ·þÎñÆ÷¼¶±ð¿ØÖÆÊý¾Ý ......