[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Ò»)
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Ò»)--αÁÐROWNUMʹÓü¼ÇÉ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(¶þ)--±êÁ¿×Ó²éѯ
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Èý)--PackageµÄÓŵã
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(ËÄ)--ÅúÁ¿´¦Àí
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Îå)--µ÷Óô洢¹ý³Ì·µ»Ø½á¹û¼¯
[Oracle]¸ßЧµÄPL/SQL³ÌÐòÉè¼Æ(Áù)--%ROWTYPEµÄʹÓÃ
--1. È¡Ç°10ÐÐ
select * from hr.employees where rownum<=10
--2. °´ÕÕfirst_nameÉýÐò£¬È¡Ç°10λ
--ÕýÈ··½·¨ oracle´¦Àí»úÖÆ: --> hr.employeesÈ«±íɨÃè
--> SORT ORDER BY STOPKEY Ö»ÅÅÐòÇ°10ÐУ¬×÷Ϊһ¸ö¾ØÕó½á¹¹
-->ʣϵÄÐÐÓëµÚ10ÐнøÐбȽϣ¬ºÏÊʵĽøÈë¾ØÕó,·ñÔòÅ×Æú
--Óŵ㣺RAMÖÐÉÙÁ¿ÅÅÐò£¬Ëٶȿì(²»ÐèÒªÔÚÄÚ´æ»òÕßtemp±í¿Õ¼ä½øÐÐÈ«±íÅÅÐò), ²¢²»ÕæÕýÅÅÐòÕû¸ö½á¹û¼¯£¬µ«¸ÅÄîÉÏ×öÁËÕû¸ö½á¹û¼¯µÄÅÅÐò
--×¢ÒâµÚÒ»,¶þ¸örownumµÄÇø±ð
select rownum,t.* from (select rownum,employees.* from hr.employees order by first_name) t where rownum<=10
--Ö´Ðмƻ®
SELECT STATEMENT, GOAL = CHOOSE Cost=5 Cardinality=10 Bytes=15622
COUNT STOPKEY
VIEW Object owner=SCOTT  
Ïà¹ØÎĵµ£º
ÔÚDELPHIÖг£³£ÒªÓõ½ADOQUERYÖеÄSQLÓï¾äÔö¼ÓÐÅÏ¢ºóÖ´ÐУ¬µ±ÒªÇóÔö¼ÓÌõ¼þ£¨Èç²ÎÊýʱ£©ÖмäµÄ¼ä¸ôºÜÖØÒª£¬¸ã²»ºÃ¾ÍÒª³ö´í£ºÏ¾ÙÀý˵Ã÷ÎÒÒª±í´ïµÄÒâ˼£º
È磺һ¸ö±í:student ÓÐ ksh,xm,xb,lqzy,lqcc¼¸¸ö×ֶΣ¬¶¼Îª×Ö·ûÐÍ¡£ÏÖÒªÇó°´xb·Ö×éͳ¼ÆÈËÊý£¬Í¬Ê±lqccÒªÇóÏÞ¶¨Ìõ¼þ¡£
Ò»°ãÇé¿öϵÄSQLÓï¾äÓ¦¸ÃΪ£º select xb,count(*) ......
ÔÚʹÓÃODP.NET½øÐÐOracle±à³Ìʱ£¬ÓÐʱºòSQLÓï¾ä·Ç³£¸´ÔÓ£¬ÐèÒª²ÉÓö¯Ì¬¹¹Ôì²éѯÓï¾äµÄÇé¿ö£¬ÓÐÁ½ÖÖ·½·¨¿ÉÒÔ¹¹Ô춯̬µÄSQLÓï¾ä£¬²¢Ö´Ðзµ»Ø½á¹û¼¯¡£
1¡¢ÔÚÊý¾Ý·ÃÎʲ㹹ÔìSQLÓï¾ä
ÀýÈçÏÂÃæµÄÓï¾ä£¬½«¹¹ÔìÍêÕûµÄSQLÓï¾ä¸³Öµ¸øCommandText£¬ÔÙ´«µÝµ½Êý¾Ý¿â½øÐÐÖ´ÐУ¬·µ»Ø½á¹û¼¯¡£
loadCommand.CommandType = Com ......
BUILTIN\Administrators
-- Õâ¸öÊÇAdmin×éµÄȨÏÞ,ĬÈÏÇé¿öϱ¾µØAdmin¶¼Á¥ÊôÓÚÕâ¸ö×é,¾ßÓбȽϴóµÄȨÏÞ,
-- ×÷ΪWindows¼¯³ÉµÇ¼,Èç¹ûʹÓõÄÊǹÜÀíÔ±,¾Í»áʹÓõ½Ëü,
HC811\ASPNET
-- Õâ¸öÊÇASPNETÓ¦ÓõķÃÎÊÕʺÅ×é,
HC811\SQLServer2005MSFTEUser$HC811$MSSQLSERVER
-- Õâ¸öÊÇÈ«ÎÄË÷ÒýµÄ·ÃÎÊÕʺ ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
Èç¹ûÎÒÃÇ°´ÕÕʾÀýÏëµÃµ½Ã¿¸ö²¿ÃÅнˮֵ×î¸ßµÄ¹ÍÔ±µÄ¼Í¼£¬¿ÉÒÔÓÐËÄÖÖ·½·¨ÊµÏÖ£ ......
±¾ÏµÁÐÎÄÕµ¼º½
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Ò»)--sum()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(¶þ)--max()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(Èý)--row_number() /rank()/dense_rank()
[Oracle]¸ßЧµÄSQLÓï¾äÖ®·ÖÎöº¯Êý(ËÄ)--lag()/lead()
ÓÐʱºò±¨±íÉÏÃæÐèÒªÏÔʾ¸Ã±Ê²Ù×÷µÄÉÏÒ»²½Öè»òÕßÏÂÒ»²½ÖèµÄÏêϸÐÅÏ¢£¬Õâ¸öʱºò¿ ......