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

OracleµÄrownumÔ­ÀíºÍʹÓÃ

Ô­Îijö×Ô£ºhttp://tenn.javaeye.com/blog/99339
ÔÚOracle
ÖУ¬Òª°´Ìض¨Ìõ¼þ²éѯǰNÌõ¼Ç¼£¬Óøörownum
¾Í¸ã¶¨ÁË¡£ 
select * from emp where rownum
 <= 5 
¶øÇÒÊéÉÏÒ²¸æ½ë£¬²»ÄܶÔrownum
ÓÃ">"£¬ÕâÒ²¾ÍÒâζ×Å£¬Èç¹ûÄãÏëÓÃ
 
select * from emp where rownum
 > 5 
ÔòÊÇʧ°ÜµÄ¡£ÒªÖªµÀΪʲô»áʧ°Ü£¬ÔòÐèÒªÁ˽ârownum
±³ºóµÄ»úÖÆ£º 
1 Oracle
 executes your query.
2 Oracle
 fetches the first row and calls it row number 1.
3 Have we gotten past row number meets the criteria? If no, then Oracle
 discards the row, If yes, thenOracle
 return the row.
4 Oracle
 fetches the next row and advances the row number (to 2, and then to 3, and then to 4, and so forth).
5 Go to step 3.
Á˽âÁËÔ­Àí£¬¾ÍÖªµÀrownum
>²»»á³É¹¦£¬ÒòΪÔÚµÚÈý²½µÄʱºò²éѯ³öµÄÐÐÒѾ­±»¶ªÆú£¬µÚËIJ½²é³öÀ´µÄrownum
ÈÔÈ»ÊÇ1,ÕâÑùÓÀÔ¶Ò²²»»á³É¹¦¡£
ͬÑùµÀÀí£¬rownum
Èç¹ûµ¥¶ÀÓÃ=,Ò²Ö»ÓÐÔÚrownum
=1ʱ²ÅÓÐÓá£
¶ÔÓÚrownum
À´ËµËüÊÇoracle
ϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖƲéѯ·µ»ØµÄ×ÜÐÐÊý£¬¶øÇÒrownum
²»ÄÜÒÔÈκαíµÄÃû³Æ×÷Ϊǰ׺¡£
 ¾ÙÀý˵Ã÷£º
ÀýÈç±í£ºstudent(ѧÉú)±í£¬±í½á¹¹Îª£º
ID¡¡¡¡¡¡    char(6)¡¡¡¡¡¡¡¡¡¡ --ѧºÅ
name¡¡¡¡¡¡¡¡VARCHAR2(10)¡¡¡¡¡¡--ÐÕÃû create table student (ID char(6), name VARCHAR2(100));
insert into sale values('200001',‘ÕÅÒ»’);
insert into sale values('200002',‘Íõ¶þ’);
insert into sale values('200003',‘ÀîÈý’);
insert into sale values('200004',‘ÕÔËÄ’);
commit;
(1) rownum
 ¶ÔÓÚµÈÓÚijֵµÄ²éѯÌõ¼þ
Èç¹ûÏ£ÍûÕÒµ½Ñ§Éú±íÖеÚÒ»ÌõѧÉúµÄÐÅÏ¢£¬¿ÉÒÔʹÓÃrownum
=1×÷ΪÌõ¼þ¡£µ«ÊÇÏëÕÒµ½Ñ§Éú±íÖеڶþÌõѧÉúµÄÐÅÏ¢£¬Ê¹ÓÃrownum
=2½á¹û²é²»µ½Êý¾Ý¡£ÒòΪrownum
¶¼ÊÇ´Ó1¿ªÊ¼£¬µ«ÊÇ1ÒÔÉϵÄ×ÔÈ»ÊýÔÚrownum
×öµÈÓÚÅжÏÊÇʱÈÏΪ¶¼ÊÇfalseÌõ¼þ£¬ËùÒÔÎÞ·¨²éµ½rownum
 = n£¨n>1µÄ×ÔÈ»Êý£©¡£
SQL> select rownum
,id,name from student where rownum
=1;£¨¿ÉÒÔÓÃÔÚÏ


Ïà¹ØÎĵµ£º

Ö»¶ÁȨÏÞoracleÓû§

-- Create the user
create user SMCQUERY
  identified by SMCQUERY;
-- Grant/Revoke role privileges
grant connect to SMCQUERY;
-- Grant/Revoke system privileges
grant select any table to SMCQUERY;
grant debug any procedure to SMCQUERY;
grant debug connect session to SMCQUERY;
grant cr ......

oracle Ô¼Êø(constraint)µÄ¼¸¸ö²ÎÊýµÄСÑо¿

Ê×ÏȸãÇåϼ¸¸ö¸ÅÄ
ORACLEÖУ¬Ô¼Êø·Ödeferred ¸ú immediate 2ÖÖ£º
  deferred:Èç¹û Oracle ÔÚÊÂÎñÌá½»£¨commit£©Ê±²Å¶ÔÔ¼ÊøÖ´Ðмì²é£¬Ôò³Æ´ËÔ¼ÊøÊÇÑӳٵģ¨deferred£©¡£Èç¹ûÊý¾ÝÎ¥·´ÁËÑÓ³ÙÔ¼Êø£¬Ìá½»²Ù×÷½«µ¼ÖÂÊÂÎñ±»»Ø¹ö£¨undo£©¡£
  immediate:Èç¹ûÔ¼ÊøÊǼ´Ê±µÄ£¨immediate£©£¨·ÇÑӳٵģ©£¬Ôò´ËÔ¼Êø½«ÔÚ ......

OracleÓöµ½µÄÎÊÌâ

ÅäÖÃÐÅÏ¢Ó¦¸Ã¶¼Ã»ÓÐ´í£¬Çý¶¯Ò²·´¸´¼ÓÔØÁË£¬Ã»ÓÐÎÊÌâ
ÔËÐÐMyeclipse±àÒë¿É¹ý£¬ÔÚÍøÒ³²âÊÔʱ³öÏÖÈçÏ´íÎó£º
java.sql.SQLException: µ÷ÓÃÖÐÎÞЧµÄ²ÎÊý
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
 at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError ......

ÓÃradiusºÍoracle×öÈÏÖ¤¼Æ·Ñϵͳ


Redhat
as4 + oracle 10g(10.2.0)
+ freeradius1.1.2+ tomcat5.5
*****************************
±¾ÎÄĿ¼
********************************
Ò»¡¢°²×°
redhat as4
¶þ¡¢°²×°
oracle 10g
£¨
10201_database_linux32.zip
£©
   
£¨Ò»£©¼ì²é
oracle 10g
ËùÐèµÄ°ü×é¼þ£º
£¨¶þ£©ÉèÖÃϵͳ²ÎÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ