OracleÖÐrownumµÄÓ÷¨
1¡¢²éѯµÚ¼¸ÐеļǼ
select sal from emp where rownum=1; //²éѯµÃµ½µÚÒ»ÐмǼ
select sal from emp where rownum=5; //²»¿ÉÒÔ²éѯµ½µÚÎåÐмǼ£¬ÒòΪrownum ×ÜÊÇ´Ó1¿ªÊ¼²éѯµÄ£¬¹ÊÕâÖÖ·½Ê½²»¿ÉÒÔÖ±½ÓµÃµ½µÚ¼¸ÐеļǼ¡£ÈôÏëµÃµ½µÚÎåÐмǼ£¬Ó¦²ÉÓÃÈçÏ·½Ê½£º
select r,sal from (select rownum r,sal from emp) where r= 5;
2¡¢ÓÃÀ´»ñÈ¡Ç°¼¸ÐеļǼ£¬¼´Ð¡ÓÚijֵµÄ¼Ç¼¡£
Àý£º²éѯǰËÄÐеļǼ
select rownum,sal from emp where rownum<5;
3¡¢ÓÃÀ´»ñÈ¡ºó¼¸ÐеļǼ£¬¼´´óÓÚijֵµÄ¼Ç¼¡£Àý£º²éѯµÚÎåÐÐÖ®ºóµÄ¼Ç¼
select r,sal from (select rownum r,sal from emp ) where r>5;
4¡¢²éѯһ¸ö·¶Î§ÄڵļǼ¡£Èç²éѯµÚÈýÐе½µ×°ËÐеļǼ£º
select r,sal from (select rownum r,sal from emp) where r>=3 and r<=8;
5¡¢rownum ÓëÅÅÐò
select rownum,sal from emp order by sal;
´ÓÕâÌõÓï¾äµÄÔËÐнá¹ûÄã¿ÉÒÔ·¢ÏÖ£¬rownum²»ÊÇ´Ó1 Ò»´ÎÔö´ó£¬¶øÊÇÂҵģ¬Êµ¼ÊÉÏÕâЩrownumÊÇָÿÌõ¼Ç¼δÅÅÐò֮ǰËù´¦µÄÐÐÊý£¬µ±È»Õâ²»ÊÇÎÒÃÇÏëÒªµÄ½á¹û£¬ÄÇôÈçºÎµÃµ½rownumÒ²ÊÇ˳ÐòÅÅÁеIJéѯ½á¹ûÄØ£¿Õâ¾ÍÐèÒªÏȶÔԼͼÅÅÐò£¬È»ºó´ÓеÄ˳ÐòÖÐÌáÈ¡³örownumºÍÏëÒªµÄ¼Ç¼ÄÚÈÝ¡£È磺
select rownum,sal from (select * from emp order by sal) ;
select rownum, sal from (select * from emp order by sal ) where rownum <5;
select r, sal from (select rownum r,sal from (select * from emp order by sal )) where r >5;
select r, sal from (select rownum r,sal from (select * from emp order by sal ))
where r >5 and r < 10;
Ïà¹ØÎĵµ£º
HWMÊÇoracleÖÐblockÓÐûÓÐʹÓõķֽçÏߣ¬Ëü»áËæ×ÅÊý¾ÝµÄinsert¶øÉÏÉý£¬µ«Ëü²¢²»»áËæÊý¾ÝµÄdelete¶øϽµ£¬Òò´ËÈ«±íɨÃèµÄʱ¼ä²¢²»ÒòÊý¾ÝµÄdelete¶ø¼õÉÙ£¬Ïà·´¿ÉÄÜÓÉÓÚ¿éÇå³ý·´¶øÈ«±íɨÃèʱ¼äÔö¼Ó£¬¿ÉÒÔÓÃÏÂÃæ·½·¨µÄÈÎÒ»Ò»ÖÖÀ´½µµÍHWM£º
µÚÒ»ÖÖ£ºshrink
ÊÊÓÃÓÚ10gÒÔºóµÄ°æ±¾£¬Ç°ÌáÊÇÕâ¸ö±í£¬Ë÷Òý£¬ÎﻯÊÓͼ»òÎﻯÊÓͼlogËùÔ ......
sql½Å±¾£¬Ò²¾ÍÊÇÔÚÎļþÖÐдÓÐsqlÓï¾äµÄÎļþ£¬¿ÉÒÔÔÚsqlplusÖÐÔËÐС£
ÒýÈësql½Å±¾
sqlplus Óû§Ãû/ÃÜÂë @sql½Å±¾.sql
£¨×¢Ò⣺ÔÚÓû§ÃûÃÜÂëÊäÈë½áÊøºóÒ»¶¨Òª¼Ó¿Õ¸ñÈ»ºóÔÙд@sql½Å±¾£©
OracleÖеĿÕÖµ»áµ±×÷ÎÞÇî´ó´¦Àí£¬Æäʵ¿ÕÖµ¸ù±¾¾Í²»»á´æ´¢£¬Ö»ÊÇ¿´×÷ÊÇÎÞÇî´ó¡£
OracleÖпØÖÆ´¦Àíº¯Êý NVL(×Ö¶ÎÃû£¬ ......
author:skate
time:2009/10/23
ÕâÁ½ÌìÒ»ÅóÓÑÎÊÈçºÎ¸ü¸ÄÊý¾Ý¿âÃû£¬ÓÚÊÇ×ö¸ö²âÊÔ£¬¼òµ¥¼Ç¼Ï£¬ÒÔ±ã˵Ã÷ÎÊÌâ
ÈçºÎÐÞ¸ÄÊý¾Ý¿âÃû£¨db_name)¼°ÊµÀýÃû(Instance_name or Service_name)
NidÊÇOracle´Ó9iR2¿ªÊ¼ÌṩµÄ¹¤¾ß£¬¿ÉÒÔÓÃÀ´¸ü¸ÄÊý¾Ý¿âÃû³Æ£¬¶øÎÞÐèͨ¹ý֮ǰÖؽ¨¿ØÖÆÎļþµÈ·±Ëö·½Ê½¡£
nidÊÇ×Ô´øµÄ¹¤¾ß£¬ÔÚoracle_home/b ......
ΪÁË°ïÖúÆóÒµÌá¸ßÔ±¹¤Ð§Á¦£¬¼×¹ÇÎĹ«Ë¾ÈÕÇ°ÔÚ2009¼×¹ÇÎÄÈ«Çò´ó»áÉÏÍƳö×îаæOracle PeopleSoft Enterprise¹ÜÀíÈí¼þ£¬¼´PeopleSoft EnterpriseÈËÁ¦×ʱ¾¹ÜÀí9.1¡¢PeopleSoft Enterprise PeopleTools 8.50¡¢PeopleSoft Enterpriseѧϰ¹ÜÀí9.1ºÍPeopleSoft EnterpriseÃÅ»§9.1¡£¡¡¡¡Õâ¸öÎüÊÕÁËÀ´×Ô150¶à¸ö¿Í»§µÄ·´À¡ÐÅÏ¢ ¶ø¿ª·¢ ......
ʹÓÃCursor:
--²âÊÔһϣ¬½ñÌì²ÅÉêÇëʹÓÃitpub.net µÄblog
declare
RoomID Room.RoomID%Type;
RoomName Room.RoomName%Type;
cursor crRoom is
select RoomID,RoomName
from Room;
begin
open crRoom;loop;
fetch crRoom into RoomID,RoomName;
exit when crRoom%notFound;
end loop;
close crRoom;
end;
& ......