Çó½ÌÒ»¸öoracle±à³ÌÌâ.... - Oracle / ¸ß¼¶¼¼Êõ
Óиö±íA±í,B±í,È»ºóÁ½¸ö±í¶¼Ö»ÓÐkey ºÍvalueÁ½¸ö×Ö¶Î.
È»ºóÅжÏA±íºÍB±íµÄµÄkeyÈç¹ûÏàͬµÄ»°,°ÑA±íµÄvalueÐ޸ijÉΪBµÄvalue
ÔÙÎÊÏÂcash when...then...else..endÖпÉÒÔǶÌ×¼¸¸öelse??
update a
set value = (select value from b
where b.key = a.key)
where exists (select 1 from b
where b.key = a.key)
update a set a.value=(select value from b where a.key=key)
ÔÎ!!!
ΪʲôÏÖÔÚ×ÜÊÇ°ÑÓÐЩsqlÏ븴ÔÓÁËÄØ??
Ïà¹ØÎÊ´ð£º
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
--½¨Á¢Ò»¸ö°üÒÔ¶¨ÒåÒ»¸öÓαê
create or replace package PK_test
as
type cur_test is ref cursor;
end PK_test;
--½¨Á¢Ò»¸ö¹ý³Ì,ͨ¹ýÊäÈëJOBID£¬·µ»ØÒ»¸ö±í¼Ç¼£¨Óα꣩!
create or replace ......
OracleÖÐÓû§ÃûÊÇʲô£¿
ÃèÊöÇå³þÒ»µã£¡
ORACLEÊý¾Ý¿âÖÐÓкܶàÄÚÖõÄÓû§Ãû£¬sys¾Í²»ËµÁË£¬»¹ÓÐscottÃÜÂëÊÇtiger.³ýÁËsys,ÆäËûÓû§¶¼ÊÇËù¶¨µÄ£¬½â³ýËø¶¨ºó²ÅÄÜʹÓá£ÔÚ±¾»úµÇ½Êý¾Ý¿âʱ£¬sysµÄÃÜÂë¿ÉÒÔËæÒâÊäÈë¡£
......
ͨ¹ýNAME×Ö¶ÎÌõ¼þ²éѯһ¸öÊý¾Ý±í£¬¼ÙÉèÎÒÓÐ100¸öÐÕÃû£¬ÓÐÒÔÏÂÁ½¸ö·½·¨£¬
·½·¨1£º
°Ñ100¸öName ×é³ÉÒ»¸öSQLÓï¾ä£¬±ÈÈç Select * from tmp_table where Name='ÕÅÈý' or Name ='ÀîËÄ' Or ...Or Name='µÚÒ»°Ù¸öÐÕÃû'
......
½ñÌìÓöµ½Ò»¸öºÜ¹îÒìµÄÎÊÌâ¡£ÎÒÔÚÒ»ÕűíÖÐÐÂÔöÁËÒ»¸ö×ֶΡ£È»ºóÓÃÈçϽű¾¸üÐÂÕâ¸ö×ֶεÄÖµ£º
SQL code:
update ibp_fund_information_tab set yield = 7.4520 where fund_code = '040003' and info_date = ......