oracleÁÙʱ±íµÄÓ÷¨×ܽá
ǰ¶Îʱ¼ä£¬Ð¹«Ë¾µÄÃæÊÔ¹ÙÎÊÁËÒ»¸öÎÊÌ⣬ÁÙʱ±íµÄ×÷Óã¬ÒÔǰÎÒÃÇÓûº´æÖмäÊý¾Ýʱºò£¬¶¼ÊÇ×Ô¼º½¨Ò»¸öÁÙʱ±í¡£Æäʵoracle±¾ÉíÔÚÕâ·½Ãæ¾ÍÒѾ¿¼ÂǺÜÈ«ÁË£¬³ý·ÇÓÐЩ¸ß¼¶Ó¦Óã¬ÎÒÔÙ¿¼ÂÇ×Ô¼º´´½¨ÁÙʱ±í¡£ÓÉÓÚ±¾È˶ÔÁÙʱ±íµÄÁ˽ⲻÊǺܶ࣬ÓÚÊÇ»ØÀ´ËѼ¯ÏÂÕâ·½ÃæµÄ×ÊÁÏ£¬ÃÖ²¹ÏÂÕâ¿éµÄ²»×ã¡£
1¡¢Ç°ÑÔ
ĿǰËùÓÐʹÓÃOracle×÷ΪÊý¾Ý¿âÖ§³Åƽ̨µÄÓ¦Ó㬴󲿷ÖÊý¾ÝÁ¿±È½ÏÅÓ´óµÄϵͳ£¬¼´±íµÄÊý¾ÝÁ¿Ò»°ãÇé¿ö϶¼ÊÇÔÚ°ÙÍò¼¶ÒÔÉϵÄÊý¾ÝÁ¿¡£
µ±È»ÔÚOracleÖд´½¨·ÖÇøÊÇÒ»ÖÖ²»´íµÄÑ¡Ôñ£¬µ«Êǵ±Äã·¢ÏÖÄãµÄÓ¦ÓÃÓжàÕÅ±í¹ØÁªµÄʱºò£¬²¢ÇÒÕâЩ±í´ó²¿·Ö¶¼ÊDZȽÏÅӴ󣬶øÄã¹ØÁªµÄʱºò·¢ÏÖÆäÖеÄijһÕÅ»òÕßij¼¸ÕÅ±í¹ØÁªÖ®ºóµÃµ½µÄ½á¹û¼¯·Ç³£Ð¡²¢ÇÒ²éѯµÃµ½Õâ¸ö½á¹û¼¯µÄËٶȷdz£¿ì£¬ÄÇôÕâ¸öʱºòÎÒ¿¼ÂÇÔÚOracleÖд´½¨“ÁÙʱ±í”¡£
ÎÒ¶ÔÁÙʱ±íµÄÀí½â£ºÔÚOracleÖд´½¨Ò»ÕÅ±í£¬Õâ¸ö±í²»ÓÃÓÚÆäËûµÄʲô¹¦ÄÜ£¬Ö÷ÒªÓÃÓÚ×Ô¼ºµÄÈí¼þÏµÍ³Ò»Ð©ÌØÓй¦ÄܲÅÓõ쬶øµ±ÄãÓÃÍêÖ®ºó±íÖеÄÊý¾Ý¾ÍûÓÃÁË¡£OracleµÄÁÙʱ±í´´½¨Ö®ºó»ù±¾²»Õ¼Óñí¿Õ¼ä£¬Èç¹ûÄãûÓÐÖ¸¶¨ÁÙʱ±í£¨°üÀ¨ÁÙʱ±íµÄË÷Òý£©´æ·ÅµÄ±í¿ÕµÄʱºò£¬Äã²åÈëµ½ÁÙʱ±íµÄÊý¾ÝÊÇ´æ·ÅÔÚORACLEϵͳµÄÁÙʱ±í¿Õ¼äÖУ¨TEMP£©¡£
2¡¢ÁÙʱ±íµÄ´´½¨
´´½¨OracleÁÙʱ±í£¬¿ÉÒÔÓÐÁ½ÖÖÀàÐ͵ÄÁÙʱ±í£º
»á»°¼¶µÄÁÙʱ±í
ÊÂÎñ¼¶µÄÁÙʱ±í¡£
1£© »á»°¼¶µÄÁÙʱ±íÒòΪÕâÕâ¸öÁÙʱ±íÖеÄÊý¾ÝºÍÄãµÄµ±Ç°»á»°ÓйØÏµ£¬µ±Ä㵱ǰSESSION²»Í˳öµÄÇé¿öÏ£¬ÁÙʱ±íÖеÄÊý¾Ý¾Í»¹´æÔÚ£¬¶øµ±ÄãÍ˳öµ±Ç°SESSIONµÄʱºò£¬ÁÙʱ±íÖеÄÊý¾Ý¾ÍÈ«²¿Ã»ÓÐÁË£¬µ±È»Õâ¸öʱºòÄãÈç¹ûÒÔÁíÍâÒ»¸öSESSIONµÇ½µÄʱºòÊÇ¿´²»µ½ÁíÍâÒ»¸öSESSIONÖвåÈëµ½ÁÙʱ±íÖеÄÊý¾ÝµÄ¡£¼´Á½¸ö²»Í¬µÄSESSIONËù²åÈëµÄÊý¾ÝÊÇ»¥²»Ïà¸ÉµÄ¡£µ±Ä³Ò»¸öSESSIONÍ˳öÖ®ºóÁÙʱ±íÖеÄÊý¾Ý¾Í±»½Ø¶Ï£¨truncate table£¬¼´Êý¾ÝÇå¿Õ£©ÁË¡£»á»°¼¶µÄÁÙʱ±í´´½¨·½·¨£º
Create Global Temporary Table Table_Name
(Col1 Type1,Col2 Type2...) On Commit Preserve Rows£»
¾ÙÀý£º
create global temporary table Student
(Stu_id Number(5),
Class_id Number(5),
Stu_Name Varchar2(8),
Stu_Memo varchar2(200)) on Commit Preserve Rows ;
2£© ÊÂÎñ¼¶ÁÙʱ±íÊÇÖ¸¸ÃÁÙʱ±íÓëÊÂÎñÏà¹Ø£¬µ±½øÐÐÊÂÎñÌá½»»òÕßÊÂÎñ»Ø¹öµÄʱºò£¬ÁÙʱ±íÖеÄÊý¾Ý½«×ÔÐб»½Ø¶Ï£¬ÆäËûµÄÄÚÈݺͻỰ¼¶µÄÁÙʱ±íµÄÒ»Ö£¨°üÀ¨Í˳öSESSIONµÄʱºò£¬ÊÂÎñ¼¶µ
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
ORDER BY ÅÅÐò
ASC ÉýÐò(ĬÈÏ)
DESC ½µÐò
select * from s_emp order by dept_id , salary desc
²¿ÃźÅÉýÐò£¬¹¤×ʽµÐò
¹Ø¼ü×ÖdistinctÒ²»á´¥·¢ÅÅÐò²Ù×÷¡£
select * from employee order by 1; //°´µÚÒ»×Ö¶ÎÅÅÐò
NULL±»ÈÏΪÎÞÇî´ó¡£order by ¿ÉÒÔ¸ú±ðÃû¡£
select table_name ......
ÏÈÀ´¿´¿´¹Ù·½ÎĵµÖжÔÕâ¸ö²ÎÊýµÄ½âÊÍ
CURSOR_SHARING
PropertyDescription
Parameter type
String
Syntax
CURSOR_SHARING = { SIMILAR | EXACT | FORCE }
Default value
EXACT
Modifiable
ALTER SESSION, ALTER SYSTEM
Basic
No
CURSOR_SHARING determines what kind of SQL statements can share the same cu ......
Ò»Ö±Ìýµ½µÄ¶¼ÊÇ˵¾¡Á¿ÓÃexists²»ÒªÓÃin£¬ÒòΪexistsÖ»ÅжϴæÔÚ¶øinÐèÒª¶Ô±ÈÖµ£¬ËùÒÔexists±È½Ï¿ì£¬µ«¿´ÁË¿´ÍøÉϵÄһЩ¶«Î÷²Å·¢ÏÖ¸ù±¾²»ÊÇÕâô»ØÊ¡£
ÏÂÃæÕâ¶ÎÊdzµÄ
Select * from T1 where x in ( select y from T2 )
Ö´ÐеĹý³ÌÏ൱ÓÚ:
select *
......