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

ORACLE rownumÓ÷¨(ZT

 
ÈçºÎÕýÈ·ÀûÓÃRownumÀ´ÏÞÖÆ²éѯËù·µ»ØµÄÐÐÊý£¿
º¬Òå½âÊÍ£º  
1¡¢rownumÊÇoracleϵͳ˳Ðò·ÖÅäΪ´Ó²éѯ·µ»ØµÄÐеıàºÅ£¬·µ»ØµÄµÚÒ»ÐзÖÅäµÄÊÇ1£¬µÚ¶þÐÐÊÇ2£¬
¡¡ ÒÀ´ËÀàÍÆ£¬Õâ¸öα×ֶοÉÒÔÓÃÓÚÏÞÖÆ²éѯ·µ»ØµÄ×ÜÐÐÊý¡£
2¡¢rownum²»ÄÜÒÔÈκλù±íµÄÃû³Æ×÷Ϊǰ׺¡£  
ʹÓ÷½·¨£º  
ÏÖÓÐÒ»¸öÉÌÆ·ÏúÊÛ±ísale£¬±í½á¹¹Îª£º
month¡¡¡¡¡¡ char(6)¡¡¡¡¡¡¡¡¡¡ --Ô·Ý
sell¡¡¡¡¡¡¡¡number(10,2)¡¡¡¡¡¡--ÔÂÏúÊÛ½ð¶î
create table sale (month char(6),sell number);
insert into sale values('200001',1000);
insert into sale values('200002',1100);
insert into sale values('200003',1200);
insert into sale values('200004',1300);
insert into sale values('200005',1400);
insert into sale values('200006',1500);
insert into sale values('200007',1600);
insert into sale values('200101',1100);
insert into sale values('200202',1200);
insert into sale values('200301',1300);
insert into sale values('200008',1000);
commit;
SQL> select rownum,month,sell from sale where rownum=1;£¨¿ÉÒÔÓÃÔÚÏÞÖÆ·µ»Ø¼Ç¼ÌõÊýµÄµØ·½£¬±£Ö¤²»³ö´í£¬È磺ÒþʽÓα꣩
   ROWNUM MONTH       SELL
--------- ------ ---------
        1 200001      1000
SQL> select rownum,month,sell from sale where rownum=2;£¨1ÒÔÉ϶¼²é²»µ½¼Ç¼£©
ûÓв鵽¼Ç¼
SQL> select rownum,month,sell from sale where rownum>5;
£¨ÓÉÓÚrownumÊÇÒ»¸ö×ÜÊÇ´Ó1¿ªÊ¼µÄαÁУ¬Oracle ÈÏΪÕâÖÖÌõ¼þ²»³ÉÁ¢£¬²é²»µ½¼Ç¼£©
ûÓв鵽¼Ç¼
Ö»·µ»ØÇ°3Ìõ¼Í¼
SQL> select rownum,month,sell from sale where rownum<4;
ROWNUM MONTH SELL
--------- ------ ---------
1 200001 1000
2 200002 1100
3 200003 1200
ÈçºÎÓÃrownumʵÏÖ´óÓÚ¡¢Ð¡ÓÚÂß¼­£¿£¨·µ»ØrownumÔÚ4—10Ö®¼äµÄÊý¾Ý£©£¨minus²Ù×÷£¬ËÙ¶È»áÊÜÓ°Ï죩
SQL> select rownum,month,sell from sale where rownum<10
2 minus
3 select rownum,month,sell from sale where rownum<5;
ROWNUM MONTH SELL
--------- ------ ---------
5 200005 1400
6 200006 1500
7 200007 1600
8 200101 1


Ïà¹ØÎĵµ£º

oracle ±í¿Õ¼ä²Ù×÷

oracle±í¿Õ¼ä²Ù×÷Ïê½â
  1
  2
  3×÷Õߣº   À´Ô´£º    ¸üÐÂÈÕÆÚ£º2006-01-04 
  5
  6 
  7½¨Á¢±í¿Õ¼ä
  8
  9CREATE TABLESPACE data01
 10DATAFILE '/ora ......

Oracle ´æ´¢¹ý³Ì

 
create or replace procedure p   //ÓоÍÌæ»»£¬Ã»Óоʹ´½¨
is
     cursor c is
         select * from emp for update;
begin
  for v_emp in c loop
      if (v_emp.deptno =10) then
 &nb ......

Oracle ´¥·¢Æ÷

 
create table emp2_log(
 uname varchar2(20),
 action varchar(10),
 atime date
);
create or replace trigger trig
   after insert or delete or update on emp2 for each row  //°óÔÚÒ»ÕűíÉÏ,before after ¶¼¿É
ÒÔ,beforeÊÇ ²åÊý¾Ý֮ǰ£¬afterÊÇÖ®ºó
begin
 &nb ......

Oracle ³£Óú¯Êý תÌû


nvl( ) º¯Êý
ʾÀý Çë²ÎÔÄ
´ÓÁ½¸ö±í´ïʽ·µ»ØÒ»¸ö·Ç null Öµ¡£
Óï·¨
NVL(eExpression1, eExpression2)
²ÎÊý
eExpression1, eExpression2
Èç¹û eExpression1 µÄ¼ÆËã½á¹ûΪ null Öµ£¬Ôò NVL( ) ·µ»Ø eExpression2¡£Èç¹û eExpression1 µÄ¼ÆËã½á¹û²»ÊÇ null Öµ£¬Ôò·µ»Ø eExpression1¡£eExpression1 ºÍ eExpression2 ¿ÉÒÔ ......

ÆÀ:Å·ÃË×èÄÓOracle¼æ²¢Sun

 ËäÈ»ÎÒÃÇÖªµÀÉ̵À¹îÒ²,ÕâÆªÎÄÕ»¹ÊÇÄܹ»ÈÃÎÒÃÇ´ÓijЩ½Ç¶ÈÉϹ۲졣±ÈÈçÅ·ÃËÓµ»¤¿ª·Å¼¼Êõ,Å·ÃËÒªÆÀ¼ÛOracleÓµÓÐMySQLºÍJavaËùÔì³ÉµÄÓ°Ïì,everything is politicalÒÑÈ»ÊÇÒ»Ìõ´ó·¹æÔòÁË£¬ÎÒÃÇ»¹ÊÇÄܹ»Ðá³öÕâ¸ö»Ï×ÓÏÂÃæÂôµÃ»¹ÊÇÀûÒæ¹Ï·ÖµÄÀϾÀ¸ð£¬×ܲ»ÄÜɶºÃʶ¼ÈÃÄãÃÀ¹úÀÐÕ¼ÁË¡£µ«ÊÇÎÒÏëÒ²Ö»ÊǸöʱ¼äÎÊÌ⣬ҲÐí±³ºóÍÆÊÖÒ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ