OracleÅÅÐòÒÔ¼°ÐòºÅµÄÏÔʾ
ÔÚÒ»°ãSelectÓï¾äÖÐÎÒÃÇͨ¹ýOrder by ...Asc/DescÀ´½øÐÐÅÅÐò¡£µ«ÊÇÕâÖÖÅÅÐò·½Ê½ÔÚÊä³öʱ£¬²»°üº¬ÅÅÐòºóµÄÐòºÅÐÅÏ¢¡£
ÏÖÔÚ½éÉÜÒ»ÏÂOracleÖпÉÒÔÓÃÓÚÅÅÐòÊä³öµÄ·½·¨¡£
1. RANK ( ) OVER ( [query_partition_clause] order_by_clause )
RANK ( ) OVER ( [query_partition_clause] order_by_clause )ÖÐ[query_partition_clause]±íʾOracleÖзÖ×é·½·¨£¬Í¨³£Óï¾ä¸ñʽΪ£ºpartition by ÁÐÃû1[,ÁÐÃû2...]
order_by_clause ±íʾÅÅÐòµÄÒÀ¾Ý£¬Í¨³£Óï¾ä¸ñʽΪOrder by ÁÐÃû1[,ÁÐÃû2...]¡£ÕâÓëSelectÓï¾äÖÐOrder by Óï¾äÏàͬ¡£Ò»Ñù¿ÉÒÔÔÚÁÐÃûºóÌí¼ÓAsc£¨Ä¬ÈÏ£©»òDesc½øÐÐÉýÐòºÍ½µÐòµÄÑ¡Ôñ¡£
²ÉÓÃRANK ( ) OVER ( [query_partition_clause] order_by_clause )ºóÐòºÅµÄ¸ñʽÈçÏÂÀý:1,2,2,4,5,5,5,8,9,10...
RANK ( ) OVER ( [query_partition_clause] order_by_clause )¶ÔÓÚ²éѯ³öÓï¾äÒ²»á½øÐÐ×Ô¶¯ÅÅÐò¡£
Àý£º±íScoreTbÊý¾ÝÈçÏÂ
GroupID PLAYNAME SCORE
---------- ------------------ -------------------- ----------
01 a1 100
01 a2 100
&
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
ÔÚJ2EEÓ¦ÓóÌÐò¿ª·¢ÖУ¬Ó¦ÓóÌÐòÓëÊý¾Ý¿âÁ¬½ÓµÄ½¨Á¢ÊÇÎÒÃǾ³£Óöµ½µÄÎÊÌâÖ®Ò»¡£ÔÚÕâÀïÎÒÖ÷Ҫ̸̸ÔÚ±¾µØÓ¦ÓóÌÐòÖÐͨ¹ýOCI·½Ê½¡¢thin·½Ê½ºÍJdbcOdbcÇÅ·½Ê½Á¬½ÓOracleÊý¾Ý¿â£¬ÔÚiPlanet Application Server 6.5ºÍSun ONE Application Server 7ÖжÔOracleÊý¾Ý¿âÁ¬½Ó³ØµÄÅäÖÃÒÔ¼°Ó¦ÓÃÖÐÈçºÎ´ÓÁ¬½Ó³ØÖлñµÃÁ¬½Ó¡£
Ò»¡¢±¾µØÍ¨¹ýJ ......
¹ÜÀí°²È«ÐÔ
1 Oracle±êʾ·û
¢Ù²»ÊDZ£Áô×Ö
¢Ú1~30¸ö×Ö·û
¢ÛÖ»ÄÜÊÇ×ÖĸºÍ#¡¢$¡¢_
¢Ü²»Äܰüº¬µ¥ÒýºÅºÍË«ÒýºÅ
2 Óû§
ÔÚOracleÖУ¬Êý¾Ý¿âÓû§ºÍģʽÊǰ²È«µÄ×î»ù±¾µ¥Ôª¡£
£¨1£©Óû§ºÍģʽ
Êý¾Ý¿âģʽ¶¨ÒåΪÊý¾Ý¿â¶ÔÏóµÄ¼¯ºÏ£¬¶øÄ£Ê½µÄÃû³Æ¾ÍÊÇÓµÓлò¿ØÖÆÕâЩÊý¾Ý¿â¶ÔÏ󼯺ϵÄÓû§Ãû³Æ¡£
£¨2£©½¨Á¢Ó ......
ÎÊÌ⣺
1. oracleÖÐnumber£¬char/varchar£¬dateµÈÊý¾ÝÀàÐÍÊÇÔõô´æ´¢µÄ£¿×Ö½ÚÁ÷ÊÇʲôÑùµÄ£¿
2. ¸÷ÖÖÊý¾ÝÀàÐÍÕ¼ÓõÄ×Ö½Ú³¤¶ÈÊǶà´ó£¿
SELECT dump(1), DUMP(123456), DUMP(-123456), DUMP(1234567890123456) -- ÕûÊý
--SELECT DUMP(123456.789), DUMP(-123456.789), dump(1.234567890123456789E15), dump(1234567890123 ......
OracleÐÔÄÜÓÅ»¯ÓëDelphi´úÂë
¸ÕѧÁ˵ãoracle·½ÃæµÄ֪ʶ£¬¸Ð¾õÒÔǰд´úÂëֻƾϲºÃд£¬ÍêȫûÓÐÉԵÓÉ£¬µ¼ÖÂÔÚÄÚÐÐÈË¿´À´£¬Ð´µÄ¶¼ÊÇÀ¬»ø´úÂ룬ÏÖÔھͰÑѧµ½µÄһЩ¶«Î÷д³öÀ´£¬Ò²ËãÊǸø¸ÕÈëÃŵÄÅóÓÑÒ»µã°ïÖú°É¡£
ÒÔǰ£¬Ð´Êý¾Ý¿â·ÃÎÊ´úÂ룬¸Ð¾õºÜ¼òµ¥£¬²»¾ÍÊÇsqlÓï¾äÂËùÒÔʲôÓï¾ä¶¼ÊÇÕâÑùд£º
A£º
......