OracleÖеÄNullÖµ½âÎö
ÓÐÈË×ܽáÁËÊý¾Ý¿âÖÐNullÖµµÄ¸ÅÄ±È½Ï¾«Á¶£¬ÕªÂ¼ÈçÏ£º
NullÊÇÊý¾Ý¿âÖÐÌØÓеÄÊý¾ÝÀàÐÍ£¬µ±Ò»Ìõ¼Ç¼µÄij¸öÁÐΪNull£¬Ôò±íʾÕâ¸öÁеÄÖµÊÇδ֪µÄ¡¢ÊDz»È·¶¨µÄ¡£¼ÈÈ»ÊÇδ֪µÄ£¬¾ÍÓÐÎÞÊýÖֵĿÉÄÜÐÔ¡£Òò´Ë£¬Null²¢²»ÊÇÒ»¸öÈ·¶¨µÄÖµ¡£
ÕâÊÇNullµÄÓÉÀ´¡¢Ò²ÊÇNullµÄ»ù´¡£¬ËùÓкÍNullÏà¹ØµÄ²Ù×÷µÄ½á¹û¶¼¿ÉÒÔ´ÓNullµÄ¸ÅÄîÍƵ¼³öÀ´¡£
ÅжÏÒ»¸ö×Ö¶ÎÊÇ·ñΪNull£¬ Ó¦¸ÃÓÃIS Null»òIS NOT Null£¬¶ø²»ÄÜÓÑ=’¡£¶ÔNullµÄÅжÏÖ»Äܶ¨ÐÔ£¬¼ÈÊDz»ÊÇNull£¨IS Null/IS NOT Null£©£¬¶ø²»Äܶ¨Öµ¡£¼òµ¥µÄ˵£¬ÓÉÓÚNull´æÔÚ×ÅÎÞÊýµÄ¿ÉÄÜ£¬Òò´ËÁ½¸öNull²»ÊÇÏàµÈµÄ¹Øϵ£¬Í¬ÑùÒ²²»ÄÜ˵Á½¸öNull¾Í²»ÏàµÈ£¬»òÕ߱ȽÏÁ½¸ö NullµÄ´óС£¬ÕâЩ²Ù×÷¶¼ÊÇûÓÐÒâÒ壬µÃ²»µ½Ò»¸öÈ·ÇеĴ𰸵ġ£Òò´Ë£¬¶ÔNullµÄ=¡¢!=¡¢>¡¢<¡¢>=¡¢<=µÈ²Ù×÷µÄ½á¹û ¶¼ÊÇδ֪µÄ£¬Ò²¾ÍËã˵£¬ÕâЩ²Ù×÷µÄ½á¹ûÈÔÈ»ÊÇNull¡£
ͬÀí£¬¶ÔNull½øÐÐ+¡¢-¡¢*¡¢/µÈ²Ù×÷µÄ½á¹ûÒ²ÊÇδ֪µÄ£¬ËùÒÔÒ²ÊÇNull¡£
ËùÒÔ£¬ºÜ¶àʱºò»áÕâÑù×ܽáNull£¬³ýÁËIS Null¡¢IS NOT NullÒÔÍ⣬¶ÔNullµÄÈκβÙ×÷µÄ½á¹û»¹ÊÇNull¡£
Oracle ÖеÄNullÖµºÍSQL Server ÖеIJ¶à£¬µ«ÊÇÓиöÃ÷ÏÔµÄÇø±ð£¬ÔÚOracleÖпÕ×Ö·û´®(‘’)±»ÊÓ×÷NullÖµ¡£ORACLEÔÊÐíÈκÎÒ»ÖÖÊý¾ÝÀàÐ͵Ä×Ö¶ÎΪNull£¬³ýÁËÒÔÏÂÁ½ÖÖÇé¿ö£º
1. Ö÷¼ü×ֶΣ¨primary key£©;
2. ¶¨ÒåʱÒѾ¼ÓÁËNOT NullÏÞÖÆÌõ¼þµÄ×Ö¶Î
˵ÁËÕâô¶à£¬ÎÒÃÇÀ´¿´Ò»Ð©Àý×Ó¡£
1. Null ±È½Ï
SQL> select 1 from dual where Null=Null;
-------------------------------------------------------------------------------
ûÓв鵽¼Ç¼
SQL> select 1 from dual where Null='';
-------------------------------------------------------------------------------
ûÓв鵽¼Ç¼
SQL>select 1 from dual where ''='';
-------------------------------------------------------------------------------
ûÓв鵽¼Ç¼
SQL> select 1 from dual where Null is Null;
-------------------------------------------------------------------------------
1
SQL>se
Ïà¹ØÎĵµ£º
½ñÌìÔÚÍøÉÏÂҹ䣬¿´µ½Ò»Æª²»´íµÄÎÄÕ£¬¹ØÓÚORACLEÃÜÂëÎļþµÄ£¬ÀíÂÛѧϰ+¸öÈËʵ¼ù£¬ºÇºÇ£¬¸´ÖƹýÀ´£¬·½±ãÒÔºóѧϰ¡£
===============================================================================
ÀíÂÛ²¿·Ö
Oracle¹ØϵÊý¾Ý¿âϵͳÒÔÆä׿ԽµÄÐÔÄÜ»ñµÃÁ˹㷺µÄÓ¦Ó㬶ø±£Ö¤Êý¾Ý¿â°²È«ÐÔÊÇÊý¾Ý¿â¹ÜÀí¹¤×÷µÄÖØÒªÄÚÈÝ¡£±¾ ......
1¡¢ÓÃdblinkÁ´½Óoracle
£¨1£©Óëƽ̨Î޹صÄд·¨£º
create public database
link cdt connect to apps
identified by apps using '(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.31.205.100)(PORT = 1541))
)
(CONNECT_DATA =
(SERVICE_NAME = CDT)
)
)'
£¨2£©¿ÉÒÔ½«µ¥ÒýºÅÄÚµÄÄÚÈÝ ......
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii(’A’) A,ascii(’a’) a,ascii(’0’) zero,ascii(’ ’) space from dual;
A A ZERO SPACE
--------- --------- --------- ---------
65 97 48 32
2.CHR
¸ø³öÕ ......
½ñÌìÔÚnet managerÅäÖñ¾µØ·þÎñʱ³öÏÖÕâÑùµÄÎÊÌâ
ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor
ÔÚgoogleÉÏËÑË÷µÃµ½Èô¸É´ð°¸£¬×ÜÊDz»¶Ô£¬ºóÀ´ÔÚͬʵİïÖúϽâ¾öÁËÎÊÌ⣬ÏÖÔÚ×ܽáһϸú´ó¼Ò·ÖÏí¡£
1¡¢Ñ¡Öб¾µØ——·þÎñÃüÃû£¬ÔÚ±à¼Öд´½¨
2¡¢ÊäÈënet·þÎñÃû£¬×¢ÒâÕâÊÇ ......