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

ORACLE¶Ô×ÖĸºÍÊý×Ö»ìºÏµÄÊý¾ÝÅÅÐò

Ö÷ÒªÊÇͨ¹ýreplaceºÍtranslateÀ´ÊµÏÖ
SQL> create view v_tt
2 as
3 select ename||' '||deptno as data
4 from emp;
View created.
SQL> select * from v_tt;
DATA
---------------------------------------------------
SMITH 20
ALLEN 30
WARD 30
JONES 20
MARTIN 30
BLAKE 30
CLARK 10
SCOTT 20
KING 10
TURNER 30
ADAMS 20
DATA
---------------------------------------------------
JAMES 30
FORD 20
MILLER 10
14 rows selected.
//by deptno
SQL> select * from v_tt
2 order by replace(data,replace(translate(data,'0123456789','##########'),'#'
,''),'');
DATA
---------------------------------------------------
CLARK 10
KING 10
MILLER 10
JONES 20
FORD 20
ADAMS 20
SMITH 20
SCOTT 20
WARD 30
TURNER 30
ALLEN 30
DATA
---------------------------------------------------
JAMES 30
BLAKE 30
MARTIN 30
14 rows selected.
//by name
SQL> select * from v_tt
2 order by data,replace(translate(data,'0123456789','##########'),'#','');
DATA
---------------------------------------------------
ADAMS 20
ALLEN 30
BLAKE 30
CLARK 10
FORD 20
JAMES 30
JONES 20
KING 10
MARTIN 30
MILLER 10
SCOTT 20
DATA
---------------------------------------------------
SMITH 20
TURNER 30
WARD 30
14 rows selected.


Ïà¹ØÎĵµ£º

oracle ±í¿Õ¼ä²Ù×÷

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

oracle union

select t.lot_number
from inv.mtl_onhand_quantities_detail t
left join mtl_system_items_b mi
on t.inventory_item_id = mi.inventory_item_id
where mi.segment1 like '101%' and mi.organization_id = 102
group by t.lot_number having count(*)=1 union
select t.lot_number||'x'
......

oracleµÄË÷ÒýÏÝÚå

Ò»¸ö±íÖÐÓм¸°ÙÍòÌõÊý¾Ý£¬¶Ôij¸ö×ֶμÓÁËË÷Òý£¬µ«ÊDzéѯʱÐÔÄܲ¢Ã»ÓÐʲôÌá¸ß£¬ÕâÖ÷Òª¿ÉÄÜÊÇoracleµÄË÷ÒýÏÞÖÆÔì³ÉµÄ¡£
¡¡¡¡oracleµÄË÷ÒýÓÐһЩË÷ÒýÏÞÖÆ£¬ÔÚÕâЩË÷ÒýÏÞÖÆ·¢ÉúµÄÇé¿öÏ£¬¼´Ê¹ÒѾ­¼ÓÁËË÷Òý£¬oracle»¹ÊÇ»áÖ´ÐÐÒ»´ÎÈ«±íɨÃ裬²éѯµÄÐÔÄܲ»»á±È²»¼ÓË÷ÒýÓÐËùÌá¸ß£¬·´¶ø¿ÉÄÜÓÉÓÚÊý¾Ý¿âά»¤Ë÷ÒýµÄϵͳ¿ªÏúÔì³ÉÐÔÄܸ ......

OracleÄÚÖú¯ÊýSQLCODEºÍSQLERRMµÄʹÓÃ

      OracleÄÚÖú¯ÊýSQLCODEºÍSQLERRMÊÇÌرðÓÃÔÚOTHERS´¦ÀíÆ÷ÖУ¬·Ö±ðÓÃÀ´·µ»ØOracleµÄ´íÎó´úÂëºÍ´íÎóÏûÏ¢¡£
¡¡¡¡
¡¡¡¡OTHERS´¦ÀíÆ÷Ó¦¸ÃÊÇÒì³£´¦Àí¿éÖеÄ×îºóµÄÒì³£´¦ÀíÆ÷£¬ÒòΪËüÊÇÓÃÀ´²¶»ñ³ýÁ˱ðµÄÒì³£´¦ÀíÆ÷´¦ÀíÒÔÍâµÄËùÓеÄOracleÒì³££¬ËùÒÔÔÚ³ÌÐòµÄ×îÍâ²ãʹÓÃÒ»¸öOTHERS´¦ÀíÆ÷µÄ»°£¬ ......

ORACLE ÔÚWHERE×Ó¾äÖÐÒýÓÃÁбðÃûµÄÎÊÌâ

SQL> select sal,comm from emp
2 where sal<2000;
SAL COMM
---------- ----------
800
1600 300
1250 500
1250 1400
1500 0
1100
950
1300
8 rows selected.
SQL> select sal as salary,comm as ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ