SQL Server¡¢OracleºÍMySQLÖвé³öֵΪNULLµÄÌæ»»
SOURCE: CLICK HERE
±¾ÎĽ²ÊöSQL Server¡¢Oracle¡¢MySQL²é³öֵΪNULLµÄÌæ»»¡£
ÔÚSQL Server Oracle MySQLµ±Êý¾Ý¿âÖвé³öijֵΪNULLÔõô°ì?
1¡¢MSSQL: ISNULL()
Óï·¨
ISNULL ( check_expression , replacement_value )
²ÎÊý
check_expression
½«±»¼ì²éÊÇ·ñΪ NULLµÄ±í´ïʽ¡£check_expression ¿ÉÒÔÊÇÈκÎÀàÐ͵ġ£
replacement_value
ÔÚ check_expression Ϊ NULLʱ½«·µ»ØµÄ±í´ïʽ¡£replacement_value ±ØÐëÓë check_expresssion ¾ßÓÐÏàͬµÄÀàÐÍ¡£
·µ»ØÀàÐÍ
·µ»ØÓë check_expression ÏàͬµÄÀàÐÍ¡£
×¢ÊÍ
Èç¹û check_expression ²»Îª NULL£¬ÄÇô·µ»Ø¸Ã±í´ïʽµÄÖµ£»·ñÔò·µ»Ø replacement_value¡£
2¡¢Oracle: NVL()
Óï·¨
NVL(eExpression1, eExpression2)
²ÎÊý
eExpression1, eExpression2
Èç¹û eExpression1 µÄ¼ÆËã½á¹ûΪ null Öµ£¬Ôò NVL() ·µ»Ø eExpression2¡£Èç¹û eExpression1 µÄ¼ÆËã½á¹û²»ÊÇ null Öµ£¬Ôò·µ»Ø eExpression1¡£eExpression1 ºÍ eExpression2 ¿ÉÒÔÊÇÈÎÒâÒ»ÖÖÊý¾ÝÀàÐÍ¡£Èç¹û eExpression1 Óë eExpression2 µÄ½á¹û½ÔΪ null Öµ£¬Ôò NVL( ) ·µ»Ø NULL
·µ»ØÖµÀàÐÍ
×Ö·ûÐÍ¡¢ÈÕÆÚÐÍ¡¢ÈÕÆÚʱ¼äÐÍ¡¢ÊýÖµÐÍ¡¢»õ±ÒÐÍ¡¢Âß¼ÐÍ»ò null Öµ
˵Ã÷
ÔÚ²»Ö§³Ö null Öµ»ò null ÖµÎ޹ؽôÒªµÄÇé¿öÏ£¬¿ÉÒÔʹÓà NVL( ) À´ÒÆÈ¥¼ÆËã»ò²Ù×÷ÖÐµÄ null Öµ¡£
3¡¢Mysql: IFNULL()
Óï·¨
IFNULL(expr1,expr2)
²ÎÊý
expr1,expr2
¼ÙÈçexpr1²»ÊÇNULL£¬IFNULL()·µ»Øexpr1£¬·ñÔòËü·µ»Øexpr2¡£IFNULL()·µ»ØÒ»¸öÊý×Ö»ò×Ö·û´®Öµ£¬È¡¾öÓÚËü±»Ê¹ÓõÄÉÏÏÂÎÄ»·¾³¡£
Ïà¹ØÎĵµ£º
²é¿´oracle·þÎñÆ÷×Ö·û¼¯:select * from nls_database_parameters where parameter = 'NLS_CHARACTERSET'
ʹÓÃPl/SQL ²éѯÊý¾ÝʱÂÒÂë,²åÈëÊý¾ÝʱÂÒÂë
Êý¾Ý¿â·þÎñÆ÷µÄ×Ö·û¼¯ºÍ¿Í»§¶ËµÄ×Ö·û¼¯²»Í¬ËùÔì³ÉµÄ,ÐÞ¸ÄÊý¾Ý¿â¿Í»§¶ËµÄ×Ö·û¼¯ºÍ·þÎñÆ÷µÄ×Ö·û¼¯Ò»ÖÂ
²Ù×÷·½·¨:
oracle 9i :Ð޸ı¾µØ×¢²á±íÖÐORACLE¿Í»§¶Ëµ ......
if %time:~,2% leq 9 (set hh=0%time:~1,1%) else (set hh=%time:~,2%)
exp wzolerp/wzolerp@wzol file=E:\Êý¾Ý¿â±¸·Ý\wzolerp%date:~0,10%ÈÕ%hh%ʱ%time:~3,2%·Ö.dmp log=E:\Êý¾Ý¿â±¸·Ý\wzolerp%date:~0,10%ÈÕ%hh%ʱ%time:~3,2%·Ö.log
exp wzolwms/wzolwms@wzol file=E:\Êý¾Ý¿â±¸·Ý\wzolwms%date:~0,10%ÈÕ ......
ÈçºÎÐÞ¸ÄOracleĬÈÏÓû§ÃÜÂëÓÐЧÆÚʱ¼ä
1¡¢²é¿´Óû§µÄproifleÊÇÄĸö£¬Ò»°ãÊÇdefault£º
sql>SELECT username,PROFILE from dba_users;
2¡¢²é¿´Ö¸¶¨¸ÅÒªÎļþ£¨Èçdefault£©µÄÃÜÂëÓÐЧÆÚÉèÖãº
sql> SELECT * from dba_profiles s WHERE
  ......
Oracle¶Ô±í×öÈ«±íɨÃèµÄʱºò
£¬»áɨÃèÍêHWMÒÔÏÂ
µÄÊý¾Ý¿é¡£Èç¹ûij¸ö±ídelete(delete²Ù×÷²»»á½µµÍ¸ßˮλ)ÁË´óÁ¿Êý¾Ý£¬ÄÇôÕâʱ¶Ô±í×öÈ«±íɨÃè¾Í»á×öºÜ¶àÎÞÓù¦£¬É¨ÃèÁËÒ»´ó¶ÑÊý¾Ý¿é£¬×îºó·¢ÏÖ¿éÀïÃæ¾ÓȻûÓÐÊý¾Ý¡£
ͨ³££¬ÔÚ¶Ô±í×öÁË´óÅúÁ¿delete²Ù×÷Ö®ºó£¬¾ÍÓ¦¸ÃÂíÉϽµµÍ±íµÄ¸ßˮ룬¿ÉÒÔʹÓÃshrink ÃüÁî»òÕßalter&n ......
ÔÚoracleÖУ¬ÎÒÃÇ´´½¨Ò»¸öÖ÷¼ü£¬Ôòͬʱ×Ô¶¯´´½¨ÁËÒ»¸öͬÃûµÄΨһË÷Òý£»É¾³ýÖ÷¼ü£¬ÔòÖ÷¼üÔ¼ÊøºÍ¶ÔÓ¦µÄΨһË÷Òý¶¼É¾³ýÁË¡£ÕâÊÇÎÒÃǾ³£¼ûµ½µÄÏÖÏó¡£
·¢³öÒ»¸ö´´½¨Ö÷¼üµÄsql£¬oracleÆäʵִÐÐÁËÁ½²½£º´´½¨Ö÷¼üÔ¼Êø¡¢´´½¨/¹ØÁª ΨһË÷Òý¡£²½ÖèÊÇÕâÑùµÄ£º
´´½¨Ö÷¼üÔ¼Êøʱ£¬¼ì²é¸ÃÖ÷¼ü×Ö¶ÎÉÏÊÇ·ñÒѾ´æÔÚΨһË÷Òý¡£Èô² ......