OracleµÄNVL()º¯ÊýºÍMySQLÖеÄIfNull()º¯Êý
MS SQL ÖеÄIsNull()º¯Êý£º
IsNull ( check_expression , replacement_expression )
check_expression: ¿ÉÒÔÊÇÈκÎÀàÐÍ,½«Òª¼ì²éµÄ±í´ïʽ ²»Îª¿Õ£¬·µ»ØËü
replacement_expression: ÀàÐͱØÐëºÍcheck_expressionÏàͬ£¬check_expressionΪnull£¬·µ»ØËü
Õâ¸öº¯ÊýµÄ×÷ÓþÍÊÇ£ºÅжÏcheck_expressionÊÇ·ñΪ¿Õ£¬Îª¿Õ¾Í·µ»Øreplacement_expression£¬²»Îª¿ÕÔò·µ»Øcheck_expression
eg£º
SELECT IsNull(null,1) ·µ»Ø1
SELECT IsNull(null,’ÄÐ') ·µ»ØÄÐ
SELECT IsNull(‘’,'ÄÐ') ×¢Òâ·µ»ØµÄ²»ÊÇÄÐŶ
MS SqlÖÐµÄ IsNull( )º¯ÊýÏ൱ÓÚOracleÖÐµÄ NVL( )º¯Êý£º
NVL£¨EXP1,EXP2£©£¬º¯Êý·µ»Øexp1ºÍexp2 ÖеÚÒ»¸ö²»ÎªnullµÄÖµ¡£
Èç¹ûexp1Ϊ¿Õ¾Í·µ»Øexp2£¬·ñÔò·µ»Øexp1¡£
Ï൱ÓÚMysqlÖеÄIfNull()º¯Êý£º
Ó¦Óó¡¾°£º±ÈÈçÒ»ÕÅ±í£ºProducts £¬¸Ã±íÈ¡×Ô http://www.w3schools.com/SQL/sql_isnull.asp
P_Id
ProductName
UnitPrice
UnitsInStock
UnitsOnOrder
1
Jarlsberg
10.45
16
15
2
Mascarpone
32.56
23
3
Gorgonzola
15.67
9
20
¼ÙÉèUnitsOnOrderÕâÒ»ÁÐÊÇ¿ÉÒÔΪ¿ÕµÄ£¬¿ÉÄܺ¬ÓпÕÖµ£¬ÄÇôִÐÐ
SELECT ProductName,UnitPrice*(UnitsInStock+UnitsOnOrder) from Products ÓпÉÄÜ»á³ö´í
ÒòΪUnitsOnOrderÕâÒ»ÁÐΪ¿ÕµÄʱºò£¬ÔËËãµÄ½á¹û¾ÍÊÇ¿Õ
mssqlµÄisnull()º¯Êý¿ÉÒÔÖ¸¶¨´¦Àí¿ÕÖµµÄ·½Ê½£º
¸ÄΪÏÂÃæµÃ¾Í¿ÉÒÔÁËSELECT ProductName,UnitPrice*(UnitsInStock+isnull(UnitsOnOrder,0)) from Products
isnull(unitsOnOrder,0) unitsOnOrderΪ¿ÕµÄʱºò·µ»Ø0
COALESCE() function
COALESCE ( expression [ ,...n ] )
Ï൱ÓÚ:
COALESCE(expression1,...n) µÄ¹¦ÄÜÓëÒÔÏ CASE ±í´ïʽÏàͬ£º
CASE
WHEN (expression1 IS NOT NULL) THEN expression1
WHEN (expression2 IS NOT NULL) THEN expression2
...
ELSE expressionN
END
Ïà¹ØÎĵµ£º
°²×°…………
ÒýÓõÄhttp://mamaoyuan625.javaeye.com/blog/617502
°²×°oracle 10gºó£¬µÇ¼ ³öÏÖ
the account is locked
Õâ¸ö´íÎ󼸺õËùÓеijõѧÕ߶¼»áÓöµ½.
Æäʵ½â¾ö°ì·¨·Ç³£¼òµ¥.
ÇëÊäÈëÓû§Ãû: SYSTEM
ÊäÈë¿ÚÁî:admin(×¢Òâ,Õâ¸öÃÜÂëÊÇÄãÔÚ°²×°oracleʱµÚÒ»²½ÉèÖõÄ)
È»ºóϵͳ»áÏÔ ......
רÓÐģʽ£º
ÔÚרÓзþÎñÆ÷ÅäÖÃÖУ¬OracleΪÿ¸öÁ¬½Óµ½·þÎñÆ÷µÃ¿Í»§»úÆô¶¯Ò»¸öרÓ÷þÎñÆ÷½ø³Ì¡£Ò»¸ö¿Í»§»úµÄרÓ÷þÎñÆ÷½ø³ÌֻΪ´Ë¿Í»§»ú¹¤×÷¡£¸÷רÓ÷þÎñÆ÷½ø³ÌÍêÈ«¶ÀÁ¢£¬ÎÞÐè¹²ÏíÊý¾Ý¡£ÔÚÓû§»á»°´æÔÚµÄÕû¸ö¹ý³ÌÖУ¬ÏàÓ¦µÄרÓ÷þÎñÆ÷½ø³ÌÒ»Ö±´æÔÚ£¬²»ÂÛÓû§ÊÇ·ñ»î¶¯¡£Ö±µ½Óû§»á»°ÖÕÖ¹ºó£¬¸ÃÓ¦ÓõÄרÓ÷þÎñÆ÷½ø³Ì²ÅÖÕÖ¹¡£ÔÚ ......
phpÁ¬½Ómysql²âÊÔ´úÂ룺
$link=mysql_connect('localhost','root','123456');
if(!$link) echo "ʧ°Ü!";
else echo "³É¹¦!";
mysql_close();
?>
ÔËÐдúÂë³öÏÖ£ºCall to undefined function 'mysql_connect()'… ʧ°Ü
°Ù¶ÈÕÒµ½½á¹ûÊÇPHP+MYSQL »·¾³Ã ......
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
[root@localhost]# mysql -u root -p
Enter password:
ERROR 2002 (H ......