oracleÖÐʵÏֵݹé²éѯµÄSQL£¨connect by prior£©
Ç°¶Îʱ¼ä×öÁËÒ»¸öÐéÄâ×éÖ¯µÄ´´½¨¡£Õâ¸öÐéÄâ×éÖ¯µÄ´´½¨ÊÇ´ÓÏÖÓеÄ×éÖ¯ÖжÁÈ¡Êý¾ÝÈ»ºó½øÐзÖÎö±£´æµ½ÐéÄâ×éÖ¯±íÖС£±£´æÖ®ºóдÈÕÖ¾·½±ãͬ²½µ½ÆäËüϵͳÖС£¹«Ë¾Ê¹ÓõÄÖ÷Òª¼¼ÊõÊÇSSH¡£ÓÉÓÚÊÇÐÂÈËûÓÐʲô¾Ñ飬¼Ó֮ʱ¼ä±È½Ï½ôÆÈ£¬×îºóʹÓÃÒ»°ãµÄÂ߼˼Ïëͨ¹ýµÝ¹éÔÚhibernateÏÂ˳Àû´´½¨ÁË¡£¿ÉÊÇ´ÓÏÖÓеÄ×éÖ¯ÖжÁÈ¡10¶àÍòÌõµÄ¼Ç¼£¬È»ºóÖðÌõ·ÖÎö£¬±£´æ£¬ÔÚдÈÕÖ¾¼Ç¼£¬ÔÚΪÿ¸öÓ¦ÓÃдÏ·¢¶ÓÁнá¹ûÐÔÄܷdz£µÍ¡£ÎÒÃǵÄϵͳÖеÄÊý¾ÝҪϷ¢µ½300¶à¸öÓ¦ÓÃϵͳ£¬Ò²¾ÍÊÇ˵¶ÁÈ¡10¶àÍòÌõ¼Ç¼¾ÍÒª·ÖÎöÊ®¶àÍò´Î£¬È»ºóÖðÌõд3000¶àÍòÌõ¼Ç¼£¬Ð§ÂÊ¿ÉÏë¶øÖªÁË¡£ºóÀ´Ê¹ÓöàÏß³ÌÀ´ÊµÐÐͬ²½£¬¿ÉÊDZ£´æµÄ¹ý³ÌÒÀÈ»ÓÃÊ®¼¸·ÖÖÓ¡£Õâ¸ö¹ý³ÌÊDz»ÄÜÈÃÈ˽ÓÊܵġ£
Ö®ºóÓÅ»¯ÐÔÄܵŤ×÷תµ½ÁËÎÒµ¼Ê¦µÄÊÖÖС£ÎÒµ¼Ê¦µÄְλÊÇϵͳ¼Ü¹¹Ê¦£¬Äê½üËÄÊ®£¬¿ÉÒÔ˵ÊÇjavaÔªÀϼ¶ÈËÎïÁË¡£Á½ÌìÖ®ºó¹ûÈ»´«³öÕñ·ÜÈËÐĵÄÏûÏ¢¡£±£´æ¹¤×÷´ÓÔÀ´µÄºÄʱ10¶à·ÖÖÓ±ä³ÉÁË°ë·ÖÖÓ¡£ÕæÊÇ´óϲ°¡£¡
½ñÔçÀ´Éϰ࣬µÚÒ»¼þʾÍÊÇ¿´¿´ÊÇʲôʵÏֵġ£µÚÒ»¾ÍÊDz»Ê¹Óù«Ë¾·â×°ºÃµÄÊý¾Ý¿âÁ¬½Ó£¬²»ÊÊÓÃHQL¶øÊÇsqlÅúÁ¿±£´æ¡£Õâ¸öµ±È»ÄÜÌá¸ßºÜ´óµÄÐÔÄÜÁË¡£Ò²Åå·þµ¼Ê¦Ö®»¨ÁËÁ½ÌìµÄʱ¼ä°ÑÎÒÊ®ÌìµÄд³öÀ´µÄÂß¼ÖØÐÂÕûÀíÁËÒ»±é£¬ÕæÊDz»¼òµ¥°¡£¡×îºó¿´µ½Ò»ÌõSQLÈçÏ£ºselect * from um_org_organization_info start with ouguid=? connect by prior ouguid=parentouguid¡£¿ªÊ¼¾õµÃºÜÒÉ»ó£¬ÒÔÎÒ֮ǰËùѧϰµÄSQ֪ʶ£¬²»Ôø¿´¼û¹ýstart with ...connect by prior,ÒÉ»óÖ®¼ÊÉÏÍø¿´¿´¡£µÃÖª“Start with...Connect By prior ×Ó¾äµÝ¹é²éѯһ°ãÓÃÓÚÒ»¸ö±íά»¤Ê÷ÐνṹµÄÓ¦ÓÃ" ¡£ÖÕÓÚ´óÎòÁË¡£¸ßÊÖ¾ÍÊDz»Ò»Ñù£¬¾Ñé¶à¼ûʶ¹ã°¡¡£½ñÌìÓÖѧÁËÐÂ֪ʶÁË¡£ºÙºÙ£¡
Ïà¹ØÎĵµ£º
OracleÊý¾Ýµ¼Èëµ¼³öimp/exp¾ÍÏ൱ÓÚoracleÊý¾Ý»¹ÔÓ뱸·Ý¡£expÃüÁî¿ÉÒÔ°ÑÊý¾Ý´ÓÔ¶³ÌÊý¾Ý¿â·þÎñÆ÷µ¼³öµ½±¾µØµÄdmpÎļþ£¬impÃüÁî¿ÉÒÔ°ÑdmpÎļþ´Ó±¾µØµ¼Èëµ½Ô¶´¦µÄÊý¾Ý¿â·þÎñÆ÷ÖС£ ÀûÓÃÕâ¸ö¹¦ÄÜ¿ÉÒÔ¹¹½¨Á½¸öÏàͬµÄÊý¾Ý¿â£¬Ò»¸öÓÃÀ´²âÊÔ£¬Ò»¸öÓÃÀ´ÕýʽʹÓá£
Ö´Ðл·¾³£º¿ÉÒÔÔÚSQLPLUS.EXE»òÕßDOS£¨ÃüÁîÐУ©ÖÐÖ´Ð ......
1£¬SqlServer´æ´¢¹ý³ÌµÄÊÂÎñ´¦Àí
Ò»ÖֱȽÏͨÓõijö´í´¦ÀíµÄģʽ´ó¸ÅÈçÏ£º
Create procdure prInsertProducts
(
@intProductId int,
@chvProductName varchar(30),
@intProductCount int
)
AS
Declare @intErrorCode int
Select @intErrorCode=@@Error
Begin transaction
if @intError ......
ÔÚÎÒÃǵÄÈÕ³£±à³ÌÖУ¬Êý¾Ý¿âµÄ³ÌÐò»ù±¾É϶¼ÒªÓëSQLÓï¾ä´ò½»µÀ£¬SQLÓï¾äµÄ±àд²»¿É±ÜÃâµÄ³ÉΪһ¸öÍ·Ì۵Ť×÷¡£ÇÒÒòΪSQLÓï¾äÊÇSTRINGÀàÐÍ£¬Òò´ËÔÚ±àÒë½×¶Î²é²»³ö´í£¬Ö»Óе½ÔËÐÐʱ²ÅÄÜ·¢ÏÖ´íÎó¡£
±¾ÎĵĽâ¾ö·½°¸£¬Í¨¹ý×Ô¶¯Éú³ÉSQLÓï¾ä£¬ÔÚÒ»¶¨³Ì¶ÈÉϽµµÍ³ö´íµÄ¸ÅÂÊ£¬´Ó¶øÌá¸ß±à³ÌЧÂÊ¡£ public int ......
========µÚһƪ=========
ÔÚÒ»ÕűíÖÐij¸ö×Ö¶ÎÏÂÃæÓÐÖظ´¼Ç¼£¬Óкܶ෽·¨£¬µ«ÊÇÓÐÒ»¸ö·½·¨£¬ÊDZȽϸßЧµÄ£¬ÈçÏÂÓï¾ä£º
select data_guid from adam_entity_datas a where a.rowid > (select min(b.rowid) from adam_entity_datas b where b.data_guid = a.data_guid)
Èç¹û±íÖÐÓдóÁ¿Êý¾Ý£¬µ«ÊÇÖظ´Êý¾Ý±È½ÏÉÙ£¬ÄÇô ......
ÔÚ΢ÈíµÄSQL ServerϵͳÖÐͨ¹ýÓÐЧµÄʹÓÃË÷Òý¿ÉÒÔÌá¸ßÊý¾Ý¿âµÄ²éѯÐÔÄÜ£¬µ«ÊÇÐÔÄܵÄÌá¸ßÈ¡¾öÓÚÊý¾Ý¿âµÄʵÏÖ¡£ÔÚ±¾ÎÄÖн«»á¸æËßÄãÈçºÎʵÏÖË÷Òý²¢ÓÐЧµÄÌá¸ßÊý¾Ý¿âµÄÐÔÄÜ¡£¡¡
¡¡¡¡
¡¡¡¡ÔÚ¹ØϵÐÍÊý¾Ý¿âÖÐʹÓÃË÷ÒýÄܹ»Ìá¸ßÊý¾Ý¿âÐÔÄÜ£¬ÕâÒ»µãÊǷdz£Ã÷ÏԵġ£ÓõÄË÷ÒýÔ½¶à£¬´ÓÊý¾Ý¿âϵͳÖеõ½Êý¾ÝµÄËٶȾÍÔ½¿ì¡£È»¶ø£¬Ðè ......