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

oracle·ÖÒ³²éѯ

OracleµÄ·ÖÒ³²éѯÓï¾ä»ù±¾ÉÏ¿ÉÒÔ°´ÕÕ±¾Îĸø³öµÄ¸ñʽÀ´½øÐÐÌ×Óá£
·ÖÒ³²éѯ¸ñʽ£º
SELECT * from
(
SELECT A.*, ROWNUM RN
from (SELECT * from TABLE_NAME) A
WHERE ROWNUM <= 40
)
WHERE RN >= 21
ÆäÖÐ×îÄÚ²ãµÄ²éѯSELECT * from TABLE_NAME±íʾ²»½øÐз­Ò³µÄԭʼ²éѯÓï¾ä¡£ROWNUM <= 40ºÍRN >= 21¿ØÖÆ·ÖÒ³²éѯµÄÿҳµÄ·¶Î§¡£
ÉÏÃæ¸ø³öµÄÕâ¸ö·ÖÒ³²éѯÓï¾ä£¬ÔÚ´ó¶àÊýÇé¿öÓµÓнϸߵÄЧÂÊ¡£·ÖÒ³µÄÄ¿µÄ¾ÍÊÇ¿ØÖÆÊä³ö½á¹û¼¯´óС£¬½«½á¹û¾¡¿ìµÄ·µ»Ø¡£ÔÚÉÏÃæµÄ·ÖÒ³²éѯÓï¾äÖУ¬ÕâÖÖ¿¼ÂÇÖ÷ÒªÌåÏÖÔÚWHERE ROWNUM <= 40Õâ¾äÉÏ¡£
Ñ¡ÔñµÚ21µ½40Ìõ¼Ç¼´æÔÚÁ½ÖÖ·½·¨£¬Ò»ÖÖÊÇÉÏÃæÀý×ÓÖÐչʾµÄÔÚ²éѯµÄµÚ¶þ²ãͨ¹ýROWNUM <= 40À´¿ØÖÆ×î´óÖµ£¬ÔÚ²éѯµÄ×îÍâ²ã¿ØÖÆ×îСֵ¡£¶øÁíÒ»ÖÖ·½Ê½ÊÇÈ¥µô²éѯµÚ¶þ²ãµÄWHERE ROWNUM <= 40Óï¾ä£¬ÔÚ²éѯµÄ×îÍâ²ã¿ØÖÆ·ÖÒ³µÄ×îСֵºÍ×î´óÖµ¡£ÕâÊÇ£¬²éѯÓï¾äÈçÏ£º
SELECT * from
(
SELECT A.*, ROWNUM RN
from (SELECT * from TABLE_NAME) A
)
WHERE RN BETWEEN 21 AND 40
¶Ô±ÈÕâÁ½ÖÖд·¨£¬¾ø´ó¶àÊýµÄÇé¿öÏ£¬µÚÒ»¸ö²éѯµÄЧÂʱȵڶþ¸ö¸ßµÃ¶à¡£
ÕâÊÇÓÉÓÚCBOÓÅ»¯Ä£Ê½Ï£¬Oracle¿ÉÒÔ½«Íâ²ãµÄ²éѯÌõ¼þÍƵ½ÄÚ²ã²éѯÖУ¬ÒÔÌá¸ßÄÚ²ã²éѯµÄÖ´ÐÐЧÂÊ¡£¶ÔÓÚµÚÒ»¸ö²éѯÓï¾ä£¬µÚ¶þ²ãµÄ²éѯÌõ¼þWHERE ROWNUM <= 40¾Í¿ÉÒÔ±»OracleÍÆÈëµ½ÄÚ²ã²éѯÖУ¬ÕâÑùOracle²éѯµÄ½á¹ûÒ»µ©³¬¹ýÁËROWNUMÏÞÖÆÌõ¼þ£¬¾ÍÖÕÖ¹²éѯ½«½á¹û·µ»ØÁË¡£
¶øµÚ¶þ¸ö²éѯÓï¾ä£¬ÓÉÓÚ²éѯÌõ¼þBETWEEN 21 AND 40ÊÇ´æÔÚÓÚ²éѯµÄµÚÈý²ã£¬¶øOracleÎÞ·¨½«µÚÈý²ãµÄ²éѯÌõ¼þÍƵ½×îÄڲ㣨¼´Ê¹ÍƵ½×îÄÚ²ãҲûÓÐÒâÒ壬ÒòΪ×îÄÚ²ã²éѯ²»ÖªµÀRN´ú±íʲô£©¡£Òò´Ë£¬¶ÔÓÚµÚ¶þ¸ö²éѯÓï¾ä£¬Oracle×îÄڲ㷵»Ø¸øÖмä²ãµÄÊÇËùÓÐÂú×ãÌõ¼þµÄÊý¾Ý£¬¶øÖмä²ã·µ»Ø¸ø×îÍâ²ãµÄÒ²ÊÇËùÓÐÊý¾Ý¡£Êý¾ÝµÄ¹ýÂËÔÚ×îÍâ²ãÍê³É£¬ÏÔÈ»Õâ¸öЧÂÊÒª±ÈµÚÒ»¸ö²éѯµÍµÃ¶à¡£
ÉÏÃæ·ÖÎöµÄ²éѯ²»½ö½öÊÇÕë¶Ôµ¥±íµÄ¼òµ¥²éѯ£¬¶ÔÓÚ×îÄÚ²ã²éѯÊǸ´ÔӵĶà±íÁªºÏ²éѯ»ò×îÄÚ²ã²éѯ°üº¬ÅÅÐòµÄÇé¿öÒ»ÑùÓÐЧ¡£
ÕâÀï¾Í²»¶Ô°üº¬ÅÅÐòµÄ²éѯ½øÐÐ˵Ã÷ÁË£¬ÏÂһƪÎÄÕ»áͨ¹ýÀý×ÓÀ´Ïêϸ˵Ã÷¡£ÏÂÃæ¼òµ¥ÌÖÂÛһ϶à±íÁªºÏµÄÇé¿ö¡£¶ÔÓÚ×î³£¼ûµÄµÈÖµ±íÁ¬½Ó²éѯ£¬CBOÒ»°ã¿ÉÄÜ»á²ÉÓÃÁ½ÖÖÁ¬½Ó·½Ê½NESTED LOOPºÍHASH JOIN£¨MERGE JOINЧÂʱÈHASH JOINЧÂʵͣ¬Ò»°ãCBO²»»á¿¼ÂÇ£©¡£ÔÚÕâÀÓÉÓÚʹÓÃÁË·ÖÒ³£¬Òò´ËÖ¸¶¨ÁËÒ»¸ö·µ»ØµÄ×î´ó¼Ç¼Êý£¬NESTED LOOPÔÚ·µ»Ø¼Ç¼Êý³¬¹ý×î´óֵʱ¿ÉÒÔÂíÉÏÍ£Ö¹²¢½«½á¹û·µ»Ø¸øÖмä²ã£¬¶ø


Ïà¹ØÎĵµ£º

OracleÊý¾Ý¿âÖØÐÂÆô¶¯²½Öè

 ±¾ÎÄÏêϸµÄ½éÉÜÁËOracleÊý¾Ý¿â½ÏºÃµÄÊ®ÖÖÖØÐÂÆô¶¯²½Öè¡£
¡¡¡¡1. Í£Ó¦ÓòãµÄ¸÷ÖÖ³ÌÐò¡£
¡¡¡¡2. Í£oralceµÄ¼àÌý½ø³Ì:
¡¡¡¡$lsnrctl stop
¡¡¡¡3. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬±¸·Ý¿ØÖÆÎļþ:
¡¡¡¡SQL>alter database backup controlfile to trace;
¡¡¡¡4. ÔÚ¶ÀÕ¼µÄϵͳÓû§Ï£¬ÊÖ¹¤Çл»ÖØ×÷ÈÕÖ¾Îļþ£¬È·±£µ±Ç°ÒÑÐ޸Ĺýµ ......

OracleÊý¾Ý¿âµÄ±¸·Ý¼°»Ö¸´²ßÂÔÑо¿

1¡¢¶à¹¤Áª»úÖØ×÷ÈÕÖ¾Îļþ
¡¡¡¡Ã¿¸öÊý¾Ý¿âʵÀý¶¼ÓÐÆä×Ô¼ºµÄÁª»úÖØ×÷ÈÕÖ¾×飬ÔÚ²Ù×÷Êý¾Ý¿âʱ£¬OracleÊ×ÏȽ«Êý¾Ý¿âµÄÈ«²¿¸Ä±ä±£´æÔÚÖØ×÷ÈÕÖ¾»º³åÇøÖУ¬ËæºóÈÕÖ¾¼Ç¼Æ÷½ø³Ì£¨LGWR£©½«Êý¾Ý´Óϵͳ¹²ÓÃÇøSGA£¨System Global Area£©µÄÖØ×÷ÈÕÖ¾»º³åÇøдÈëÁª»úÖØ×÷ÈÕÖ¾Îļþ£¬ÔÚ´ÅÅ̱ÀÀ£»òʵÀýʧ°Üʱ£¬¿ÉÒÔͨ¹ýÓëÖ®Ïà¹ØµÄÁª»úÖØ×÷ÈÕÖ¾ ......

OracleÖд´½¨¡¢Ð޸ġ¢É¾³ýÐòÁÐ

1¡¢´´½¨ÐòÁÐÓï·¨£º(ÐèÒªCREATE SEQUENCEϵͳȨÏÞ)
CREATE SEQUENCE ÐòÁÐÃû
[INCREMENT BY n] ---ÓÃÓÚ¶¨ÒåÐòÁеIJ½³¤¡£
                                ......

Oracleѧϰ±Ê¼Çժ¼7

 ÓÃ;: <1>Ä£¿é»¯
<Àý×Ó> --¹«Ë¾µÄÔ±¹¤µÄ¹ÜÀí
         1.Ôö¼ÓÒ»¸öÔ±¹¤
         2.Ô±¹¤ÀëÖ°
Óô洢¹ý³ÌºÍº¯ÊýÀ´ÊµÏÖ
1.Ôö¼ÓÒ»¸öÔ±¹¤
create sequence seq1 start with 7935;
create or replace function insert ......

Oracleѧϰ±Ê¼Çժ¼9

   a)Êý¾Ý¿â±¾ÉíµÄÓÅ»¯
       ³õʼ»¯Îļþ init.ora
         open_cursors = 150 ´ò¿ªµÄÓαêµÄ¸öÊý
            ºÜ¶àµÄ´æ´¢¹ý³ÌµÄʱºò ¿ÉÒÔ°ÑËüµ÷´óЩ
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ