ORACLE Oracle·ÖÎöº¯ÊýÏêÊö¡¾¶þ¡¿
Ò».·ÖÎöº¯Êý2(rank\dense_rank\row_number)
Ŀ¼
===============================================
1.ʹÓÃrownumΪ¼Ç¼ÅÅÃû
2.ʹÓ÷ÖÎöº¯ÊýÀ´Îª¼Ç¼ÅÅÃû
3.ʹÓ÷ÖÎöº¯ÊýΪ¼Ç¼½øÐзÖ×éÅÅÃû
Ò»¡¢Ê¹ÓÃrownumΪ¼Ç¼ÅÅÃû£º
ÔÚÇ°Ãæһƪ¡¶Oracle¿ª·¢×¨ÌâÖ®£º·ÖÎöº¯Êý¡·£¬ÎÒÃÇÈÏʶÁË·ÖÎöº¯ÊýµÄ»ù±¾Ó¦Óã¬ÏÖÔÚÎÒÃÇÔÙÀ´¿¼ÂÇÏÂÃ漸¸öÎÊÌ⣺
¢Ù¶ÔËùÓпͻ§°´¶©µ¥×ܶî½øÐÐÅÅÃû
¢Ú°´ÇøÓòºÍ¿Í»§¶©µ¥×ܶî½øÐÐÅÅÃû
¢ÛÕÒ³ö¶©µ¥×ܶîÅÅÃûÇ°13λµÄ¿Í»§
¢ÜÕÒ³ö¶©µ¥×ܶî×î¸ß¡¢×îµÍµÄ¿Í»§
¢ÝÕÒ³ö¶©µ¥×ܶîÅÅÃûÇ°25%µÄ¿Í»§
°´ÕÕÇ°ÃæµÚһƪÎÄÕµÄ˼·£¬ÎÒÃÇÖ»ÄÜ×öµ½¶Ô¸÷¸ö·Ö×éµÄÊý¾Ý½øÐÐͳ¼Æ£¬Èç¹ûÐèÒªÅÅÃûµÄ»°ÄÇôֻÐèÒª¼òµ¥µØ¼ÓÉÏrownum²»¾ÍÐÐÁËÂð£¿ÊÂʵÇé¿öÊÇ·ñÈç´ËÏëÏó°ã¼òµ¥£¬ÎÒÃÇÀ´Êµ¼ùһϡ£
¡¾1¡¿²âÊÔ»·¾³£º
SQL> desc user_order;
Name Null? Type
----------------------------------------- -------- ----------------------------
REGION_ID NUMBER(2)
CUSTOMER_ID NUMBER(2)
CUSTOMER_SALES NUMBER
¡¾2¡¿²âÊÔÊý¾Ý£º
SQL> select * from user_order order by customer_sales;
REGION_ID CUSTOMER_ID CUSTOMER_SALES
---------- ----------- --------------
5 1
Ïà¹ØÎĵµ£º
ÿÌì1µãÖ´ÐеÄoracle JOBÑùÀý
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X,
what => 'ETL_RUN_D_Date;',
next_date => to_date('2009-08-26 01:00:00','yyyy-mm-dd hh24:mi:ss'),
interval => 'trunc(sysdate)+1+1/24',
no_parse => FALSE
);
SYS.DBMS_OUTPUT.PUT_LINE('Job Number ......
֮ǰ¿ª·¢OracleÒ»°ãÊÇʹÓÃPL/SQL Developer»òÕßÊÇTOAD£¬ÓÉÓÚÏÖÔÚ¹«Ë¾¶Ô°æȨÎÊÌâ¿´µÃ±È½ÏÖØ£¬ËùÒÔÎÒÒ²Ö»ÄܶÔÕâЩÊìϤµÄ¿ª·¢¹¤¾ß˵Éù°Ý°ÝÁË£¡ÔÚOracle¹Ù·½ÍøÕ¾Õ¾¿´µ½ÁËOracleÒѾÓÐÁËÒ»¸öOracle SQL Developer£¬²¢ÇÒÊÇÃâ·ÑµÄ£¡
ÒÔÏÂÊÇOracle¹Ù·½¶ÔOracle SQL DeveloperµÄ½éÉÜ
³ÌÐò´úÂë
orac ......
OracleÈÕÆÚº¯Êý¼¯½õ(Ò»)
Ò»¡¢ ³£ÓÃÈÕÆÚÊý¾Ý¸ñʽ
1.Y»òYY»òYYY ÄêµÄ×îºóһ룬Á½Î»»òÈýλ
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07
SQL> Select to_ch ......
ÓÐÁ½ÖÖº¬ÒåµÄ±í´óС¡£Ò»ÖÖÊÇ·ÖÅä¸øÒ»¸ö±íµÄÎïÀí¿Õ¼äÊýÁ¿£¬¶ø²»¹Ü¿Õ¼äÊÇ·ñ±»Ê¹Ó᣿ÉÒÔÕâÑù²éѯ»ñµÃ×Ö½ÚÊý£º
select segment_name, bytes
from user_segments
where segment_type = 'TABLE';
»òÕß
Select Segment_Name,Sum(bytes)/1024/1024 from User_Extents Group By Segment_Name
ÁíÒ»ÖÖ±íʵ¼ÊÊ¹Ó ......
δʵÑé
ORACLEÊý¾Ý¿â×Ô´øµÄDBMS_JOB¹¦ÄÜ¿ÉÒÔʵÏÖ¶¨Ê±Ö´ÐÐPL/SQLµÄ´æ´¢¹ý³Ì£¬µ«ÊÇÈç¹ûSQLÓï¾äºÜ¸´ÔÓ£¬
SQLÓï¾äºÜ¶à£¬ÒÔ¼°¾³£Òª¸Ä±äSQLÓï¾äµÄд·¨£¬ÓÃдPL/SQL´æ´¢¹ý³ÌµÄ·½·¨ÔÙ¶¨Ê±Ö´Ðлá±È½Ï·±Ëö¡£ºÎ
¿ö»¹ÓÐһЩUNIXϵͳ¹ÜÀíÔ±²»»áдPL/SQL´æ´¢¹ý³Ì£¬ËùÒÔÎÒ½éÉ ......