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

oracle Ìæ»»Êý¾ÝµÄsql¸ÃÔõôд - Oracle / ¿ª·¢

ÓÐÁ½Õűí
  A B
  id hyid hyid newid
  1 2 2 A
  2 3 3 B
  ÏÖÔÚÒª½«a±íµÄhyid»»³Éb±íµÄnewid,Çë×¢Òâa±íÖеÄhyid²»ÊÇΨһµÄ
  oracleÖиà Ôõô´¦Àí


merge into a using b 
on (a.hyid=b.hyid)
when matched then
update set a.hyid=b.newid  
a.hyid ÔÚon¾äÖÐ,²»ÄÜÐÞ¸Ä

ÎÒÁíÍâÔÚa±íÖÐŪÁËÒ»ÌõÊý¾ÝhyºÍhyid±£³ÖÒ»ÖÂ
²¢ÇÒÒòΪa±íÖеÄhyid²»ÊÇΨһµÄ,½á¹û´íÎóÎÞ·¨»ñµÃÎȶ¨ÐÐ
update a set hyid=(
  select newid from b where hyid=a.hyid)
where exists(
  select 1 from b where hyid=a.hyid)

SQL code:
update a set a.hyid=(select newid from b where b.hyid=a.hyid and rownum<2)
and exists (select 1 from b where b.hyid=a.hyid);


ÒýÓÃ
update a set hyid=(
select newid from b where hyid=a.hyid)
where exists(
select 1 from b where hyid=a.hyid)


1Â¥Õý½â£¬ÓÃmergeÎÞ·¨ÐÞ¸Ä

¿´Ñù×Ó²»´í ,²»¹ý»¹ÊÇÐ޸IJ»ÁË,´íÎó:µ¥ÐÐ×Ó²éѯ·µ»Ø¶à¸öÐÐ
 

--where rownum=1ÏÞÖÆÏÂ

update a set hyid=(
select newid from b where hyid=a.hyid where rownum=1)
where exists(
select 1 from b w


Ïà¹ØÎÊ´ð£º

oracle²¢·¢´¦ÀíSOS - Oracle / ¿ª·¢

ÎÒÔÚ¿ª·¢µÄÕâ¸öÓ¦Óò¢·¢ÐԱȽϸߣ¬oracle¸üÐÂÊý¾ÝʱºòÈçºÎ´¦Àí²¢·¢´¦ÀíÄØ£¿¸÷λ´óÏÀ·¢±íºÃµÄ¹Ûµã°¡£¬ÔÚÏߵȴý£¡
oracleÊý¾Ý¸üÐÂʱ£¬»á×Ô¶¯Ä¬ÈÏÐÐËø¶¨£¬Â¥Ö÷²»Òª²ÙÐÄ£¬Oracle¶Ô²¢Ðд¦ÀíÒѾ­ºÜ³ÉÊìÁË

ÒýÓÃ
oracle ......

oracle 9i ×î½ü·¢Ïֵǽ±¨´í - Oracle / »ù´¡ºÍ¹ÜÀí

ÓÃPL/SQL µÇ½ʱµ¯³ö±¨´í´°¿Ú£¬´íÎóÈçÏ£¡
  ORA-01034:ORACLE not available
  ORA-27101:shared memory realm does not exist
ÇëÎÊ£¬ÓÐûÓÐÈËÓöµ½ÕâÖÖÇé¿ö£¬Ôõô½â¾ö£¿Ð»Ð»£¡

1. Oracle sid ÕýÈ ......

ÇóÒ»sqlÓï¾ä - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÏÖÔÚÓÐÁ½ÕÅ±í£ºÎÄÕÂÖ÷±íA(articleId,articleTitle)£¬ÎÄÕÂÆÀÂÛ±íB(commentId,articleId,commentTitle)
ÏÖÔÚÎÒÏëʵÏÖÕâÑùµÄ¹¦ÄÜ£ºÁгöÎÄÕÂÁÐ±í£¬ÆäÖÐÿƪÎÄÕ±êÌâÏÂÃæÁгö´ËÎÄÕµÄǰ2¸öÎÄÕÂÆÀÂÛ£¬ÇëÎÊsqlÓï¾äÔõôд°¡ ......

oracle³õѧÕßÄãÇë½Ì - Oracle / »ù´¡ºÍ¹ÜÀí

--½¨Á¢Ò»¸ö°üÒÔ¶¨ÒåÒ»¸öÓαê
create or replace package PK_test 
as 
type cur_test is ref cursor;
end PK_test;
--½¨Á¢Ò»¸ö¹ý³Ì,ͨ¹ýÊäÈëJOBID£¬·µ»ØÒ»¸ö±í¼Ç¼£¨Óα꣩!
create or replace ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ