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

Oracle Connect ByÓ÷¨

Oracle Connect ByÓ÷¨
 
oracleÖеÄselectÓï¾ä¿ÉÒÔÓÃSTART WITH...CONNECT BY PRIOR×Ó¾äʵÏֵݹé²éѯ£¬connect by Êǽṹ»¯²éѯÖÐÓõ½µÄ£¬Æä»ù±¾Óï·¨ÊÇ£º
select ... from <TableName>
where <Conditional-1>
start with <Conditional-2>
connect by <Conditional-3>
;
<Conditional-1>£º¹ýÂËÌõ¼þ£¬ÓÃÓÚ¶Ô·µ»ØµÄËùÓмǼ½øÐйýÂË¡£
<Conditional-2>£º²éѯ½á¹ûÖØÆðʼ¸ù½áµãµÄÏÞ¶¨Ìõ¼þ¡£
<Conditional-3>£ºÁ¬½ÓÌõ¼þ
Êý¾Ý¿â±í½á¹¹ÈçÏ£º
create table t2(
root_id number,
id number,
name varchar(5),
description varchar(10)
);
insert into t2(root_id,id,name,description) values(0,1,'a','aaa');
insert into t2(root_id,id,name,description) values(1,2,'a1','aaa1');
insert into t2(root_id,id,name,description) values(1,3,'a2','aaa2');
insert into t2(root_id,id,name,description) values(0,4,'b','bbb');
insert into t2(root_id,id,name,description) values(4,5,'b1','bbb1');
insert into t2(root_id,id,name,description) values(4,6,'b2','bbb2');
»ñÈ¡ÍêÕûÊ÷£º
select * from t2 start with root_id = 0 connect by prior id = root_id;
 
»ñÈ¡Ìض¨×ÓÊ÷£º
select * from t2 start with id = 1 connect by prior id = root_id;
select * from t2 start with id = 4 connect by prior id = root_id;
Èç¹ûconnect by priorÖеÄprior±»Ê¡ÂÔ£¬Ôò²éѯ½«²»½øÐÐÉî²ãµÝ¹é¡£
È磺
select * from t2 start with root_id = 0 connect by id = root_id;
select * from t2 start with id = 1 connect by id = root_id;


Ïà¹ØÎĵµ£º

Oracle ×Ö·û´®³¤¶Èº¯Êý


LENGTH calculates length using characters as defined by the input character set. 
LENGTHB uses bytes instead of characters. 
VSIZE returns the number of bytes in the internal representation of expr.
LENGTHC uses Unicode complete characters. 
LENGTH2 uses UCS2 codepoints. 
......

OracleÇ¿ÐжϿªÓû§Á¬½Ó


Ê×ÏȲéÕÒÄ¿±êÓû§µÄµ±Ç°½ø³Ì£º  
select sid,serial# from v$session where username='ERP';   
²éѯ½á¹û£º
sid serial#
222 123
122 233
Ç¿ÐжϿªÓû§Á¬½Ó£º  
alter system kill session 'sid,serial';   
ÀýÈ磺    
alter system kill session '222,123'; 
......

Oracle×Ö·û¼¯


      ºÜ¶àÈ˶¼Åöµ½¹ýÒòΪ×Ö·û¼¯²»Í¬¶øʹÊý¾Ýµ¼Èëʧ°ÜµÄÇé¿ö¡£ÕâÉæ¼°Èý·½ÃæµÄ×Ö·û¼¯£¬Ò»ÊÇoracel server¶ËµÄ×Ö·û¼¯£¬¶þÊÇoracle client¶ËµÄ×Ö·û¼¯;ÈýÊÇdmpÎļþµÄ×Ö·û¼¯¡£ÔÚ×öÊý¾Ýµ¼ÈëµÄʱºò£¬ÐèÒªÕâÈý¸ö×Ö·û¼¯¶¼Ò»Ö²ÅÄÜÕýÈ·µ¼Èë¡£
¡¡¡¡1¡¢²éѯoracle server¶ËµÄ×Ö·û¼¯
¡¡¡¡ÓкܶàÖÖ·½·¨¿ÉÒÔ²é³öor ......

OracleÈÕÆÚº¯Êý next_day

ÔÚOracleÊÇÌṩÁËnext_dayÇóÖ¸¶¨ÈÕÆÚµÄÏÂÒ»¸öÈÕÆÚ.
Óï·¨ : next_day( date, weekday )
date is used to find the next weekday.
weekday is a day of the week (ie: SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY)
¿ÉÓÃÓÚ:
Oracle 9i, Oracle 10g, Oracle 11g
For example:
next_day('01- ......

SQLServerºÍOracleµÄ³£Óú¯Êý¶Ô±È

1.¾ø¶ÔÖµ 
S:select abs(-1) value
O:select abs(-1)  value from dual
2.È¡Õû(´ó) 
S:select ceiling(-1.001) value  
O:select ceil(-1.001)  value from dual
3.È¡Õû£¨Ð¡£© 
S:select floor(-1.001) value  
O:select floor(-1.001)  value from dual
4.È ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ