Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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Ç¿ÐжϿªÓû§Á¬½Ó


Ê×ÏȲéÕÒÄ¿±êÓû§µÄµ±Ç°½ø³Ì£º  
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'; 
......

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.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) value
O:selec ......

oracle ´æ´¢¹ý³ÌµÄ»ù±¾Óï·¨

1.»ù±¾½á¹¹
CREATE OR REPLACE PROCEDURE ´æ´¢¹ý³ÌÃû×Ö
(
    ²ÎÊý1 IN NUMBER,
    ²ÎÊý2 IN NUMBER
) IS
±äÁ¿1 INTEGER :=0;
±äÁ¿2 DATE;
BEGIN
END ´æ´¢¹ý³ÌÃû×Ö
2.SELECT INTO STATEMENT
  ½«select²éѯµÄ½á¹û´æÈëµ½±äÁ¿ÖУ¬¿ÉÒÔͬʱ½«¶à¸öÁд洢¶à¸ö±äÁ¿ÖУ¬±ØÐëÓÐÒ»Ì ......

BLOBת»»ÎªCLOBµÄº¯Êý£¨oracleÖÐÖ´ÐУ©

BLOBת»»ÎªCLOBµÄº¯Êý£¨oracleÖÐÖ´ÐУ©
CREATE OR REPLACE FUNCTION BlobToClob(blob_in IN BLOB) RETURN CLOB AS
  v_clob    CLOB;
  v_varchar VARCHAR2(32767);
  v_start  PLS_INTEGER := 1;
  v_buffer  PLS_INTEGER := 32767;
BEGIN
  DBMS_LOB.CRE ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ