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

oracle²éѯÁ·Ï°

empÔ±¹¤±í
(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
------1.Ñ¡Ôñ²¿ÃÅ30ÖеÄËùÓÐÔ±¹¤.
select ename
from emp
where deptno = 30;
------2.ÁгöËùÓаìÊÂÔ±(CLERK)µÄÐÕÃû£¬±àºÅºÍ²¿ÃűàºÅ.
select ename,empno,deptno
from emp
where job='CLERK';
------3.ÕÒ³öÓ¶½ð¸ßÓÚн½ðµÄÔ±¹¤.
select *
from emp
where nvl(comm,0)>sal;
------4.ÕÒ³öÓ¶½ð¸ßÓÚн½ðµÄ60%µÄÔ±¹¤.
select *
from emp
where nvl(comm,0)>sal*0.6;
------5.ÕÒ³ö²¿ÃÅ10ÖÐËùÓо­Àí(MANAGER)ºÍ²¿ÃÅ20ÖÐËùÓаìÊÂÔ±(CLERK)µÄÏêϸ×ÊÁÏ
select *
from emp
where deptno=10 and job ='manager'
 or deptno=20 and job ='CLERK';
------6.ÕÒ³ö²¿ÃÅ10ÖÐËùÓо­Àí(MANAGER),²¿ÃÅ20ÖÐËùÓаìÊÂÔ±(CLERK),¼È²»ÊǾ­ÀíÓÖ²»ÊÇ°ìÊÂÔ±µ«Æäн½ð´óÓÚ»òµÈÓÚ2000µÄËùÓÐÔ±¹¤µÄÏêϸ×ÊÁÏ.
select *
from emp
where deptno=10 and job ='manager'
 or deptno=20 and job ='CLERK'
 or deptno not in ('manager','CLERK') and sal >=2000;
------7.ÕÒ³öÊÕÈ¡Ó¶½ðµÄÔ±¹¤µÄ²»Í¬¹¤×÷.
select distinct job
from emp
where comm>0;
------8.ÕÒ³ö²»ÊÕÈ¡Ó¶½ð»òÊÕÈ¡µÄÓ¶½ðµÍÓÚ100µÄÔ±¹¤.
select *
from emp
where sal between 0 and 100
or sal is null;
------9.ÕÒ³ö¸÷Ôµ¹ÊýµÚ3ÌìÊܹ͵ÄËùÓÐÔ±¹¤.
select *
from emp
where hiredate=last_day(hiredate)-2;
------10.ÕÒ³öÔçÓÚ12ÄêÇ°Êܹ͵ÄÔ±¹¤.
select *
from emp
where hiredate<add_months(sysdate,-12*12);
------11.ÒÔÊ××Öĸ´óдµÄ·½Ê½ÏÔʾËùÓÐÔ±¹¤µÄÐÕÃû.
select initcap(ename)
from emp;
------12.ÏÔʾÕýºÃΪ5¸ö×Ö·ûµÄÔ±¹¤µÄÐÕÃû.
select *
from emp
where ename like '_____';
------13.ÏÔʾ²»´øÓÐ"R"µÄÔ±¹¤µÄÐÕÃû.
select initcap(ename)
from emp;
where ename not like '%R%';
------14.ÏÔʾËùÓÐÔ±¹¤ÐÕÃûµÄÇ°Èý¸ö×Ö·û
select substr(ename,1,3)
from emp
------15.ÏÔʾËùÓÐÔ±¹¤µÄÐÕÃû,ÓÃaÌæ»»ËùÓÐ"A"
select translate(ename,'A','a')
from emp;
------16.ÏÔʾÂú10Äê·þÎñÄêÏÞµÄÔ±¹¤µÄÐÕÃûºÍÊܹÍÈÕÆÚ.
select ename,hiredate
from emp
where hiredate>add_months(sysdate,-12*10);
------17.ÏÔʾԱ¹¤µÄÏêϸ×ÊÁÏ,°´ÐÕÃûÅÅÐò.
select *
from emp
order by ename;
------18.ÏÔʾԱ¹¤µÄ


Ïà¹ØÎĵµ£º

ORACLEµÄALL_VIEWSÊý¾Ý×Öµätext×Ö¶ÎlongÀàÐÍÎÊÌâ

½ñÌìͬÊÂraiseÒ»¸öСÎÊÌ⣬ÔõôÔÚALL_VIEWSÊý¾Ý×Öµätext×ֶβéÕÒlrf×Ö·û´®£º
etl@DWTEST> select owner,view_name from all_views where instr(text,'lrf') > 0;
select owner,view_name from all_views where instr(text,'lrf') > 0
             ......

oracle lob ¼òµ¥½éÉÜ

ºÎΪLOB£¿
lobΪoracleÊý¾Ý¿âµÄÒ»¸ö´ó¶ÔÏóÊý¾ÝÀàÐÍ,¿ÉÒÔ´æ´¢³¬¹ý4000bytesµÄ×Ö·û´®£¬¶þ½øÖÆÊý¾Ý£¬OSÎļþµÈ´ó¶ÔÏóÐÅÏ¢.×î´ó¿É´æ´¢µÄÈÝÁ¿¸ùoracleµÄ°æ±¾ºÍoracle ¿é´óСÓйØ.
ÓÐÄǼ¸Öֿɹ©Ñ¡ÔñµÄLOBÀàÐÍ?
Ä¿Ç°ORACLEÌṩÁËCLOB£¬NCLOB£¬BLOB£¬BFILE¹²ËÄÖÖLOBÀàÐÍ,CLOB,NLOBΪ´ó×Ö·û´®ÀàÐÍ,NLOBΪ¶àÓïÑÔ¼¯×Ö·ûÀàÐÍ,ÀàËÆÓÚNV ......

oracle ¼ì²é±»ËøµÄ±í¼°½âËø

´¦Àí·½·¨Ò» £º
¼ì²éÄǸö±í±»Ëø
select sess.sid,sess.serial#, lo.oracle_username,lo.os_user_name,ao.object_name,lo.locked_mode
from v$locked_object lo,dba_objects ao,v$session sess
where ao.object_id = lo.object_id
and lo.session_id = sess.sid;
½âËø
alter system kill session '273,45';
´¦Àí·½·¨¶ ......

oracle¼ì²âËø£¬ÊÍ·ÅËø

¼ì²âËø£º
SELECT A.OWNER,
A.OBJECT_NAME,
B.XIDUSN,
B.XIDSLOT,
B.XIDSQN,
B.SESSION_ID,
B.ORACLE_USERNAME,
B.OS_USER_NAME,
B.PROCESS,
B.LOCKED_MODE,
C.MACHINE,
C.STATUS,
C.SERVER,
C.SID,
C.SERIAL#,
C.PROGRAM
from ALL_OBJECTS A,
V$LOCKED_OBJECT B,
SYS.GV_$SESSION C
WHERE ( A.OBJE ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ