sqlServer,oracleÖÐcase¹Ø¼ü×ÖµÄÓ÷¨
ÔÚдSQLʱ£¬ÓÐʱҪ¸ù¾ÝÒÑÓеÄÁÐÖµ¹¹ÔìеÄÁÐÖµ£¬Õâʱ¾ÍÒªÓõ½µÄSQLÖеÄcase¹Ø¼ü×Ö¡£ÈçÏÂËùʾ²éѯ¸ºÔðÈËÐÅÏ¢±í£¨T_MS_CustomerCrmInfoDutyPerson£©ÖеÄÊÇ·ñÊÇÖ÷Òª¸ºÔðÈË£¨isMainDuty£©×ֶΣ¬µ«ÊÇÕâ¸ö×ֶεÄÖµÊÇÒÔö¾ÙµÄ·½Ê½´æ´¢µÄ£¬´æ´¢0±íʾÊÇ·ñ£¬1±íʾÊÇ£¬·ñÔò±íʾδÅжϡ£Õâʱֱ½Ó²éѯ³öµÄÖµ²»ÊÇ×Ô¼ºÐèÒªµÄÖµ£¬¿ÉÒÔÓÃcase¹Ø¼ü×ÖÖØй¹½¨ÁÐÖµ¡£
select case
when cfdutystate=0 then '·ñ'
when cfdutystate=1 then 'ÊÇ'
else null
end as isMainDuty
from T_MS_CustomerCrmInfoDutyPerson
×¢Òâµã£º
1£¬ÒÔcase¿ªÍ·£¬ÒÔend½áβ
2£¬whenºó¸úÌõ¼þ·ÖÖ§ÖУ¬thenºóΪÏÔʾ½á¹û
3£¬elseΪ³ý´ËÖ®ÍâµÄĬÈÏÇé¿ö£¬ÀàËÆÓÚjavaµÄswitch caseµÄdefault£¬¿ÉÒÔ²»¼Ó
4£¬OracleÖÐendºó¸ú±ðÃû»òÕßsqlserverÖÐÓï·¨ÈçÏ£º
isMainDuty =case
when cfdutystate=0 then '·ñ'
when cfdutystate=1 then 'ÊÇ'
else null
end
³ý´ËÖ®Í⣬caseÒ²¿ÉÒÔÓõ½group byÓï¾äÖÐÒÔ¸ù¾ÝÐèҪʵÏÖÁé»îµÄ·Ö×é²Ù×÷£¬ÈçÏÂËùʾµÄÁÐ×Ó:
SELECT
CASE
WHEN price IS NULL THEN 'Unpriced'
WHEN price < 10 THEN 'Bargain'
WHEN price BETWEEN 10 and 20 THEN 'Average'
ELSE 'Gift to impress relatives'
&n
Ïà¹ØÎĵµ£º
oracleÆô¶¯ÎÊÌâ
Ò»£ºÊý¾Ý¿âûÓÐÆô¶¯
#sqlplus /nolog
sql>connect /as sysdba
sql>startup
¶þ£º¼àÌý³öÎÊÌâ
µÇ¼DB·þÎñÆ÷
ʹÓÃlsnrctl start/stop¿ªÆô/¹Ø±Õ¼àÌý
ʹÓÃlsnrctl status²é¿´×´Ì¬
ÀíӦΪ£º
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ERPAP)(PORT=1521)))
STATUS of the ......
truncate,delete,dropµÄÒìͬµã
×¢Òâ:ÕâÀï˵µÄdeleteÊÇÖ¸²»´øwhere×Ó¾äµÄdeleteÓï¾ä
Ïàͬµã:truncateºÍ²»´øwhere×Ó¾äµÄdelete, ÒÔ¼°drop¶¼»áɾ³ý±íÄÚµÄÊý¾Ý
²»Í¬µã:
1. truncateºÍ deleteֻɾ³ýÊý¾Ý²»É¾³ý±íµÄ½á¹¹(¶¨Òå)
dropÓï¾ä½«É¾³ý±íµÄ½á¹¹±»ÒÀÀµµÄÔ¼Êø(constrain),´¥·¢Æ÷(trigger),Ë÷Òý(index); ÒÀÀµÓÚ¸Ã±íµ ......
select * from TTable1 for update Ëø¶¨±íµÄËùÓÐÐУ¬Ö»ÄܶÁ²»ÄÜд
2 select * from TTable1 where pkid = 1 for update Ö»Ëø¶¨pkid=1µÄÐÐ
3 select * from Table1 a join Table2 b on a.pkid=b.pkid for update Ëø¶¨Á½¸ö±íµÄËùÓмǼ
4 select * from Table1 a join Table2 b on a.pki ......
author£ºskate
time£º2010-05-13
1)If memory increases and you're 64-bit, e.g 8G to 16G, Oracle SGA and related parameters need adjust; So are some the Unix kernel parameters.
2)As for CPU related configuration, some parameters, based on CPU_co ......