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

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  
  &


Ïà¹ØÎĵµ£º

oracle tnsnames.oraÅäÖÃС½á

listener.ora¡¢ tnsnames.oraºÍsqlnet.oraÕâ3¸öÎļþÊǹØϵoracleÍøÂçÅäÖõÄ3¸öÖ÷ÒªÎļþ£¬ÆäÖÐlistener.oraÊǺÍÊý¾Ý¿â·þÎñÆ÷¶Ë Ïà¹Ø£¬¶øtnsnames.oraºÍsqlnet.oraÕâ2¸öÎļþ²»½ö½ö¹Øϵµ½·þÎñÆ÷¶Ë£¬Ö÷ÒªµÄ»¹ÊǺͿͻ§¶Ë¹Øϵ½ôÃÜ¡£
¼ì²é¿Í»§¶ËoracleÍøÂçµÄʱºò¿ÉÒÔÏȼì²ésqlnet.oraÎļþ£º
# SQLNET.ORA Network Configuration ......

ORACLEÒì³£´¦Àí×ܽá

£±£ºÔ¤¶¨ÒåÒì³£       ÓÃÓÚ´¦Àí³£¼ûµÄOracle´íÎó
£²£º·ÇÔ¤¶¨ÒåÒì³£    ÓÃÓÚ´¦ÀíÔ¤¶¨ÒåÒì³£Ëù²»ÄÜ´¦ÀíµÄOracle´íÎó
£³£º×Ô¶¨ÒåÒì³£       ÓÃÓÚ´¦ÀíÓÚOracle´íÎóÎ޹صÄÆäËûÇé¿ö
Òì³£´¦Àí²¿·ÖÊÇÒԹؼü×ÖEXCEPTION¿ªÊ¼µÄ£¬Óï·¨È ......

Oracleѧϰ±Ê¼Çժ¼3

 ¡¶1¡·DDLÓï¾ä(Êý¾Ý¶¨ÒåÓïÑÔ) Data Define Language
   create
   alter
   drop
   truncate ¿ªÍ·µÄÓï¾ä truncate table <±íÃû>
      Ìصã:<1>½¨Á¢ºÍÐÞ¸ÄÊý¾Ý¶ÔÏó
         &nb ......

Oracleѧϰ±Ê¼Çժ¼6


  declare
  begin
   --SQLÓï¾ä
   --Ö±½ÓдµÄSQLÓï¾ä(DML/TCL)
   --¼ä½Óдexecute immediate <DDL/DCLÃüÁî×Ö·û´®>
   --select Óï¾ä
        <1>±ØÐë´øÓÐinto×Ó¾ä
      &n ......

OracleµÄ³£ÓÃÃüÁî

 Ò»¡£Oracle·þÎñÆ÷µÄ³£ÓÃÃüÁîÐÐÏêϸ½²½â
1.Êý¾Ý¿â¹ÜÀíÏà¹Ø

 
¡¡¡¡bbed.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿éä¯ÀÀºÍ±à¼­¹¤¾ß
¡¡¡¡dbv.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾ÝÎļþÂß¼­¼ì²â¹¤¾ß
¡¡¡¡exp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼³ö¹¤¾ß
¡¡¡¡imp.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ýµ¼È빤¾ß
¡¡¡¡mig.exe¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Êý¾Ý¿âÒÆÖ²¹¤¾ß
¡¡¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ