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

Oracle ÖеÄUnion¡¢Union All¡¢Intersect¡¢Minus

ÖÚËùÖÜÖªµÄ¼¸¸ö½á¹û¼¯¼¯ºÏ²Ù×÷ÃüÁ½ñÌìÏêϸµØ²âÊÔÁËһϣ¬·¢ÏÖһЩÎÊÌ⣬¼Ç¼±¸¿¼¡£ ¼ÙÉèÎÒÃÇÓÐÒ»¸ö±íStudent£¬°üÀ¨ÒÔÏÂ×Ö¶ÎÓëÊý¾Ý£º drop table student;
create table student
(
id int primary key,
name nvarchar2(50) not null,
score number not null
);
insert into student values(1,'Aaron',78);
insert into student values(2,'Bill',76);
insert into student values(3,'Cindy',89);
insert into student values(4,'Damon',90);
insert into student values(5,'Ella',73);
insert into student values(6,'Frado',61);
insert into student values(7,'Gill',99);
insert into student values(8,'Hellen',56);
insert into student values(9,'Ivan',93);
insert into student values(10,'Jay',90);
commit;
UnionºÍUnion AllµÄÇø±ð¡£
select *
from student
where id < 4
union
select *
from student
where id > 2 and id < 6
½á¹û½«ÊÇ

1    Aaron    78

2    Bill    76

3    Cindy    89

4    Damon    90

5    Ella    73
Èç¹û»»³ÉUnion AllÁ¬½ÓÁ½¸ö½á¹û¼¯£¬Ôò·µ»Ø½á¹ûÊÇ£º

1    Aaron    78

2    Bill    76

3    Cindy    89

3    Cindy    89

4    Damon    90

5    Ella    73
¿ÉÒÔ¿´µ½£¬UnionºÍUnion AllµÄÇø±ðÖ®Ò»ÔÚÓÚ¶ÔÖظ´½á¹ûµÄ´¦Àí¡£
½ÓÏÂÀ´ÎÒÃǽ«Á½¸ö×Ó²éѯµÄ˳Ðòµ÷Õûһϣ¬¸ÄΪ
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00


Ïà¹ØÎĵµ£º

linuxÏÂoracleÆô¶¯¹ý³Ì

ÔÚlinuxÏÂÆô¶¯oracle ºÍÔÚwindowsÊÇÓвî±ðµÄ£¬¶ÔÓÚÒ»°ãÔÚwindowsϲÙ×÷Ï°¹ßÈËÓкܶ಻ÊÊÓ¦£¬ËùÒÔÎÒÌرðдÕâÑùÎÄÕ£¬ÒÔ·½±ãÐÂÊÖ½øÐвÙ×÷£¬ÏÂÃæ¾ÍÒ»²½Ò»²½½²½âÆô¶¯¹ý³Ì¡£
1.ͨ¹ýÖÕ¶ËÁ¬½Óµ½linux·þÎñÆ÷,µ±È»ÕâÑùµÄÈí¼þºÜ¶àÀýÈçputty,SecureCRT,²¢ÒÔoracleÓû§½øÐеǼ£¬·ñÔòÆô¶¯oracleʱ»á´íµÄ£¬Ã»ÓÐȨÏÞÆô¶¯.(Ò²¿ÉÓû§root µ ......

oracle ÓÅ»¯Ö® ÕÒ³öµÍЧÂÊsql Óï¾ä

SELECT EXECUTIONS , DISK_READS, BUFFER_GETS,
¡¡¡¡ROUND((BUFFER_GETS-DISK_READS)/BUFFER_GETS,2) Hit_radio,
¡¡¡¡ROUND(DISK_READS/EXECUTIONS,2) Reads_per_run,
¡¡¡¡SQL_TEXT
¡¡¡¡from V$SQLAREA
¡¡¡¡WHERE EXECUTIONS>0
¡¡¡¡AND BUFFER_GETS > 0
¡¡¡¡AND (BUFFER_GETS-DISK_READS)/BUFFER_GETS ......

Oracle Óαê Cursor ʹÓÃ

create or replace procedure getok
as
cursor mycur is select ids,name from aaa where name not in (select names from ok);
vempno aaa.ids%type;
vename aaa.name%type;
begin
open mycur;
loop
fetch mycur into vempno,vename;
exit when mycur%notfound;
if mycur%found then
    insert ......

oracleÊý¾Ý¿âµ¼Èëµ¼³ö

¸ù¾ÝÓû§µ¼³öÓï¾ä£º
1.Êý¾Ý¿âµ¼³ö
exp system/jade@JADE_166.111.134.26 file=d:\jade.dmp statistics=none
˵Ã÷£º
systeÊÇÓû§Ãû
jadeÊÇÃÜÂë
JADE_166.111.134.26ÊÇSID±êʾ
file=d:\jade.dmp Êǵ¼³öÎļþµÄ·¾¶¼°ÎļþÃû
2.Êý¾Ý¿âµ¼Èë
imp system/jade@JADE_166.111.134.26  file=d:\jade.dmp fromuser=syst ......

oracleʹÓÃ×Ó²éѯ²åÈëºÍÐÞ¸ÄÊý¾Ý

ʹÓÃ×Ó²éѯ²åÈëÊý¾Ý£º
ʾÀýÒ»£ºinsert into employee (empno,ename,sal,deptno)
           select empno,ename,sal,deptno from emp
          where deptno=20;
ʾÀý¶þ£ºinsert /*+APPEND*/ into employee (empno,e ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ