OracleÖÐStart with...Connect ByÀí½â¼°Ó÷¨
oracleÖÐconnect by priorʵÏֵݹé²éѯ
ÊÕ¼¯µÄ¼¸ÌõÔÚoracleÖÐͨ¹ýconnect by priorÀ´ÊµÏֵݹé²éѯ
Start with...Connect By×Ó¾äµÝ¹é²éѯһ°ãÓÃÓÚÒ»¸ö±íά»¤Ê÷ÐνṹµÄÓ¦Óá£
´´½¨Ê¾Àý±í£º
CREATE TABLE TBL_TEST
(
ID NUMBER,
NAME VARCHAR2(100 BYTE),
PID NUMBER DEFAULT 0
);
²åÈë²âÊÔÊý¾Ý£º
INSERT INTO TBL_TEST(ID,NAME,PID) VALUES('1','10','0');
INSERT INTO TBL_TEST(ID,NAME,PID) VALUES('2','11','1');
INSERT INTO TBL_TEST(ID,NAME,PID) VALUES('3','20','0');
INSERT INTO TBL_TEST(ID,NAME,PID) VALUES('4','12','1');
INSERT INTO TBL_TEST(ID,NAME,PID) VALUES('5','121','2');
´ÓRootÍùÊ÷Ä©Éҵݹé
select * from TBL_TEST
start with id=1
connect by prior id = pid
´ÓÄ©ÉÒÍùÊ÷ROOTµÝ¹é
select * from TBL_TEST
start with id=5
connect by prior pid = id
===============================================================================================================
ÓÐÒ»Õűí t
×ֶΣº
parent
child
Á½¸ö×ֶεĹØϵÊǸ¸×Ó¹Øϵ
дһ¸ösqlÓï¾ä£¬²éѯ³öÖ¸¶¨¸¸ÏÂÃæµÄËùÓеÄ×Ó
±ÈÈç
a b
a c
a e
b b1
b b2
c c1
e e1
e e3
d d1
Ö¸¶¨parent=a£¬Ñ¡³ö
a b
a c
a e
b b1
b b2
c c1
e e1
e e3
&
Ïà¹ØÎĵµ£º
Êý¾Ý¿âµÄÆô¶¯ÓÐÈýÖÖ£º
1
£º
startup nomount
ÕâÖÖ¹ý³ÌÓÖ³ÆΪ£º·Ç°²×°Æô¶¯
Æô¶¯¹ý³ÌΪ£ºÆô¶¯
oracle
ʵÀý£¬²»¼ÓÔØÊý¾Ý¿â£¬²»´ò¿ªÊý¾Ý¿â¡£ÔÚÕâ¸ö¹ý³ÌÖÐÖ»ÐèÒª
init.ora
³õʼ»¯²ÎÊýÎļþ£¬Öؽ¨¿ØÖÆÎļþ£¬¼´Æô¶¯ ......
1.
´íÎóÌáʾ£ºORA-12545:ÒòÄ¿±êÖ÷»ú»ò¶ÔÏó²»´æÔÚ,Á¬½Óʧ°Ü.
´íÎóÖ¢×´£ºÐ½¨µÄÊý¾Ý¿âÔÚOEM¿ØÖÆ̨ÎÞ·¨ÏÔʾ£¨sysmanÓû§µÇ½£©£¬¶ÀÁ¢Æô¶¯Ä£Ê½¿ÉÒÔÕÒµ½£¬µ«ÎÞ·¨µÇ½£¬³öÏÖÈçÉÏ´íÎó¡£
½â¾ö°ì·¨£ºÐÞ¸Äoracle°²×°Ä¿Â¼Ï£¨oracle\ora90\network\ADMIN£©µÄtnsnames.oraÎļþ£¬½«µ±Ç°Êý¾Ý¿âÌí¼Óµ½¼àÌý¶ÔÏóÖС£ÐÞ¸ÄÖ®ºó£¬¿ÉÒÔÔÚ¶ÀÁ¢Ä ......
ÓкܶàÓ¦ÓÃÏîÄ¿, ¸ÕÆð²½µÄʱºòÓÃMYSQLÊý¾Ý¿â»ù±¾ÉÏÄÜʵÏÖ¸÷ÖÖ¹¦ÄÜÐèÇó£¬Ëæ×ÅÓ¦ÓÃÓû§µÄÔö¶à£¬Êý¾ÝÁ¿µÄÔö¼Ó£¬MYSQL½¥½¥µØ³öÏÖ²»¿°ÖظºµÄÇé¿ö£ºÁ¬½ÓºÜÂýÉõÖÁå´»ú£¬ÓÚÊǾÍÓаÑÊý¾Ý´ÓMYSQLǨµ½ORACLEµÄÐèÇó£¬Ó¦ÓóÌÐòÒ²ÒªÏàÓ¦×öһЩÐ޸ġ£±¾ÈË×ܽá³öÒÔϼ¸µã×¢ÒâÊÂÏϣÍû¶Ô´ó¼ÒÓÐËù°ïÖú¡£
1£® ×Ô¶¯Ôö³¤µÄÊý¾ ......
Ò»¡£Oracle·þÎñÆ÷µÄ³£ÓÃÃüÁîÐÐÏêϸ½²½â
1.Êý¾Ý¿â¹ÜÀíÏà¹Ø
¡¡¡¡bbed.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿éä¯ÀÀºÍ±à¼¹¤¾ß
¡¡¡¡dbv.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾ÝÎļþÂß¼¼ì²â¹¤¾ß
¡¡¡¡exp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼³ö¹¤¾ß
¡¡¡¡imp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼È빤¾ß
¡¡¡¡mig.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿âÒÆÖ²¹¤¾ß
¡¡¡ ......