Oracle¿ª·¢Ö®SQLÓï¾ä°¸Àý—·ÖÎöº¯ÊýµÄʹÓÃ
´´½¨¹ÍÔ±±í£º
create table emp(deptno number(10),ename varchar2(100),sal number(10,2))£»
²åÈëÊý¾Ý
begin
insert into emp values('10','KING',5000);
insert into emp values('10','CLARK',2450);
insert into emp values('10','MILLER',1300);
insert into emp values('20','SCOTT',3000);
insert into emp values('20','FORD',3000);
insert into emp values('20','JONES',2975);
insert into emp values('20','ADAMS',1100);
insert into emp values('20','SMITH',800);
insert into emp values('30','BLAKE',2850);
insert into emp values('30','ALLEN',1600);
insert into emp values('30','TURNER',1500);
insert into emp values('30','WARD',1250);
insert into emp values('30','MARTIN',1250);
insert into emp values('30','JAMES',950);
commit;
end;
1¡¢Ê¹ÓÃrow_number()¡¢rank()¡¢dense_rank()²é³ö¸÷²¿ÃÅнˮ×î¸ßµÄÈý¸öÔ±¹¤ÐÕÃû¡¢Ð½Ë®£¬¶àÓÚÈý¸öµÄֻȡÈý¸ö¡£
select *
from (select e.deptno,
e.ename,
e.sal,
row_number() over(partition by e.deptno order by sal desc) rankno
from emp e)
where rankno <= 3;
select *
from (select e.deptno,
e.ename,
e.sal,
rank() over(partition by e.deptno order by sal desc) rankno
from emp e)
where rankno <= 3;
select *
from (select e.deptno,
e.ename,
&nb
Ïà¹ØÎĵµ£º
OracleϵÁУºÍ¼Æ¬µÄ´æ´¢
Ò»£ºÊ²Ã´ÊÇ´ó¶ÔÏ󣬴ó¶ÔÏó»ù±¾²Ù×÷£¿
²Î¼ûÎÒµÄBLOG£ºOracleϵÁУºLOB´ó¶ÔÏó´¦Àí
http://blog.csdn.net/qfs_v/archive/2008/05/21/2464599.aspx
¶þ£¬Í¼Æ¬µÄ´æ´¢»ò¶þ½øÖÆÎļþµÄ´æ´¢
1£¬ÏȲåÈëÆÕͨÊý¾Ý£¬Óöµ½´ó¶ÔÏóÁÐʹÓÃempty_blob()¹¹Ôì¿ÕµÄÖ¸Õë¡£
Àý× ......
Oracle ÈýÖÖ¼¯ºÏÊý¾ÝÀàÐ͵ıȽÏ:
PL/SQLÖÐûÓÐÊý×éµÄ¸ÅÄËûµÄ¼¯ºÏÊý¾ÝÀàÐͺÍÊý×éÊÇÏàËƵġ£ÔÚ7.3ÒÔÇ°µÄ°æ±¾ÖÐÖ»ÓÐÒ»ÖÖ¼¯ºÏ£¬³ÆΪPL/SQL±í£¬ÔÚÕâÖ®ºóÓÖÓÐÁ½ÖÖ¼¯ºÏÊý¾ÝÀàÐÍ:ǶÌ×±íºÍvarray¡£ÆäÖÐvarray¼¯ºÏÖеÄÔªËØÊÇÓÐÊýÁ¿ÏÞÖƵģ¬index_by±íºÍǶÌ×±íÊÇûÓÐÕâ¸öÏÞÖƵġ£index-by±íÊÇÏ¡ÊèµÄ£¬Ò²¾ÍÊÇ˵ϱê¿ÉÒÔ²»Á¬Ðø ......
×î½üÒ»¶Îʱ¼äһֱûд²©¿Í£¬²»ÊÇÀÁ£¬ÊÇѧÁËÌ«¶à¶«Î÷¡£ÒÔºóÂýÂý²¹ÉÏ¡£ 1. odbcÖÐÌí¼ÓoracleÊý¾ÝÔ´ odbcÖÐÌí¼ÓoracleÊý¾ÝÔ´Ê×ÒªÌõ¼þ£º°²×°oracle client¡£°²×°ÍêÖ®ºóÌí¼Ó£¬µ«ÊÇ»¹±ØÐëÔÚ°²×°Ä¿Â¼ÏÂͨ³£ÊÇC:\oracle\ora90\network\ADMIN\tnsnames.oraÖÐÌí¼ÓÒ»¸öÁ¬½Ó£¬Èçϸñʽ£º DXS =
(DESCRIPTION =
......
½ñÄêµÄOracleÈ«Çò´ó»áÓÚ10ÔÂ11ÈÕ£15ÈÕÔÚÃÀ¹ú¾É½ðɽµÄMosconeÖÐÐÄÒѾÀ¿ªÐòÄ»ÁË¡£
¡¡¡¡ Oracle¶ÔSun¹«Ë¾µÄ³¤Æڼƻ®ÎÞÒÉÊDZ¾´ÎOOW´ó»áµÄ½¹µã¡£µ«ÔÚ̸ÂÛÕâ¸ö»°Ìâ֮ǰ£¬ÎÒÃÇ×¼±¸ÁËÒ»×é´ó»áµÄÓÐȤÊý¾Ý£¬ÏÈÈôó¼Ò¶Ô±¾´Î´ó»áÓиöÕûÌåµÄÓ¡Ïó¡£
¡¡¡¡ÓйØÕû¸ö´ó»áµÄÊý×Ö£º
¡¡¡¡· ½ü4.3ÍòÈ˵½»á
¡¡¡¡· ΪÃÀ¹ ......
1)½¨Á¢²Ù×÷ϵͳĿ¼e:\test£¬×¼±¸Êý¾ÝÎļþdept.txt²¢ÖÃÓÚe:\testÖ®ÏÂ
"10","ACCOUNTING","NEW
YORK"
"20","RESEARCH","DALLAS"
"30","SALES","CHICAGO"
"40","OPERATIONS","BOSTON"
2)´´ ......