ORACLE NULLÏê½â
ÎÊ£ºÊ²Ã´ÊÇNULL£¿
´ð£ºÔÚÎÒÃDz»ÖªµÀ¾ßÌåÓÐʲôÊý¾ÝµÄʱºò£¬Ò²¼´Î´Öª£¬¿ÉÒÔÓÃNULL£¬ÎÒÃdzÆËüΪ¿Õ£¬ORACLEÖУ¬º¬ÓпÕÖµµÄ±íÁ㤶ÈΪÁã¡£
ORACLEÔÊÐíÈκÎÒ»ÖÖÊý¾ÝÀàÐ͵Ä×Ö¶ÎΪ¿Õ£¬³ýÁËÒÔÏÂÁ½ÖÖÇé¿ö£º
1¡¢Ö÷¼ü×ֶΣ¨primary key£©£¬
2¡¢¶¨ÒåʱÒѾ¼ÓÁËNOT NULLÏÞÖÆÌõ¼þµÄ×Ö¶Î
˵Ã÷£º
1¡¢µÈ¼ÛÓÚûÓÐÈκÎÖµ¡¢ÊÇδ֪Êý¡£
2¡¢NULLÓë0¡¢¿Õ×Ö·û´®¡¢¿Õ¸ñ¶¼²»Í¬¡£
3¡¢¶Ô¿ÕÖµ×ö¼Ó¡¢¼õ¡¢³Ë¡¢³ýµÈÔËËã²Ù×÷£¬½á¹ûÈÔΪ¿Õ¡£
4¡¢NULLµÄ´¦ÀíʹÓÃNVLº¯Êý¡£
5¡¢±È½ÏʱʹÓùؼü×ÖÓÓis null”ºÍ“is not null”¡£
6¡¢¿ÕÖµ²»Äܱ»Ë÷Òý£¬ËùÒÔ²éѯʱÓÐЩ·ûºÏÌõ¼þµÄÊý¾Ý¿ÉÄܲ鲻³öÀ´£¬count(*)ÖУ¬ÓÃnvl(ÁÐÃû,0)´¦ÀíºóÔٲ顣
7¡¢ÅÅÐòʱ±ÈÆäËûÊý¾Ý¶¼´ó£¨Ë÷ÒýĬÈÏÊǽµÐòÅÅÁУ¬Ð¡→´ó£©£¬ËùÒÔ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
---------
1
SQL> select 1 from dual where nvl(null,0)=nvl(null,0);
1
---------
1
¶Ô¿ÕÖµ×ö¼Ó¡¢¼õ¡¢³Ë¡¢³ýµÈÔËËã²Ù×÷£¬½á¹ûÈÔΪ¿Õ¡£
SQL> select 1+null from dual;
SQL> select 1-null from dual;
SQL> select 1*null from dual;
SQL> select 1/null from dual;
ÒÔÉÏËÄÌõÓï¾ä¾ù²éѯµ½Ò»¸ö¼Ç¼.
×¢£ºÕâ¸ö¼Ç¼¾ÍÊÇSQLÓï¾äÖеÄÄǸönull
ÉèÖÃijЩÁÐΪ¿ÕÖµ
update table1 set ÁÐ1=NULL where ÁÐ1 is not null;
ÏÖÓÐÒ»¸öÉÌÆ·ÏúÊÛ±ísale£¬±í½á¹¹Îª£º
month¡¡ char(6)¡¡ --Ô·Ý
sellnumber(10,2)¡¡--ÔÂÏúÊÛ½ð¶î
create table sale (month char(6),sell number);
insert into sale values('200001',1000);
insert into sale values('200002',1100);
insert into sale values('200003',1200);
insert into sale values('200004',1300);
insert into sale values('200005',1400);
insert into sale values('200006',1500);
insert into sale values('200007',1600);
insert into sale values('200101',1100);
insert into sale v
Ïà¹ØÎĵµ£º
±¾Îijö×Ô¡¶Íø¹ÜÔ±ÊÀ½ç¡·20002ÄêµÚ8ÆÚ“¹ÊÕÏÕï¶Ï”À¸Ä¿
Ó²¼þ»·¾³£º SUN250·þÎñÆ÷£¬1G CPU , 512M Ram , 18G SCSIÓ²ÅÌ
ϵͳ»·¾³£º SUN Solaris 2.7
·þÎñ»·¾³£º Oracle 8.1.6
ÖÜÎåÎÒ·¢ÏÖOracleÊý¾Ý¿âÔÚÖ´ÐгÌÐòʱµÄÏìÓ¦ÌرðÂý£¬Õû¸öÊý¾Ý¿â·þÎñËùÔÚµÄSUN Solaris 2.7ϵͳҲÊÇÕâÑù£¬ÎÞÂÛÔËÐÐʲô³ÌÐò¶¼±ÈÍù³£ÂýÁ˺ ......
1.USEREVN()
·µ»Øµ±Ç°Óû§»·¾³µÄÐÅÏ¢,opt¿ÉÒÔÊÇ:
ENTRYID,SESSIONID,TERMINAL,ISDBA,LABLE,LANGUAGE,CLIENT_INFO,LANG,VSIZE
1.ISDBA ²é¿´µ±Ç°Óû§ÊÇ·ñÊÇDBAÈç¹ûÊÇÔò·µ»Øtrue
SQL> select userenv('isdba') from dual;
USEREN
------
FALSE
2.SESSION ·µ»Ø»á»°±êÖ¾
SQL> select userenv('sessio ......
dba_users Êý¾Ý¿âÓû§ÐÅÏ¢
dba_segments ±í¶ÎÐÅÏ¢
dba_extents Êý¾ÝÇøÐÅÏ¢
dba_objects Êý¾Ý¿â¶ÔÏóÐÅÏ¢
dba_tablespaces Êý¾Ý¿â±í¿Õ¼äÐÅÏ¢
dba_data_files Êý¾ÝÎļþÉèÖÃÐÅÏ¢
dba_temp_files ÁÙʱÊý¾ÝÎļþÐÅÏ¢
dba_rollback_segs »Ø¹ö¶ÎÐÅÏ¢
dba_ts_quotas Óû§±í¿Õ¼äÅä¶îÐÅÏ¢
dba_free_space Êý¾Ý¿â¿ÕÏпռä ......
±¾ÎÄÖ»ÌÖÂÛOracleÖÐ×î³£¼ûµÄË÷Òý£¬¼´ÊÇB-treeË÷Òý¡£±¾ÎÄÖÐÉæ¼°µÄÊý¾Ý¿â°æ±¾ÊÇOracle8i¡£
¡¡¡¡Ò». ²é¿´ÏµÍ³±íÖеÄÓû§Ë÷Òý
¡¡¡¡ÔÚOracleÖУ¬SYSTEM±íÊÇ°²×°Êý¾Ý¿âʱ×Ô¶¯½¨Á¢µÄ£¬Ëü°üº¬Êý¾Ý¿âµÄÈ«²¿Êý¾Ý×ֵ䣬´æ´¢¹ý³Ì¡¢°ü¡¢º¯ÊýºÍ´¥·¢Æ÷µÄ¶¨ÒåÒÔ¼°ÏµÍ³»Ø¹ö¶Î¡£
¡¡¡¡Ò»°ãÀ´Ëµ£¬Ó¦¸Ã¾¡Á¿±ÜÃâÔÚSYSTEM±íÖд洢·ÇSYSTEMÓû§µÄ ......
¡¾IT168 ¼¼ÊõÎĵµ¡¿Ëæ×ÅÍøÂçÓ¦Óú͵ç×ÓÉÌÎñµÄ²»¶Ï·¢Õ¹£¬¸÷¸öÕ¾µãµÄ·ÃÎÊÁ¿Ô½À´Ô½´ó£¬ÈçºÎʹÓÐÏ޵ļÆËã»úϵͳ×ÊԴΪ¸ü¶àµÄÓû§·þÎñ£¿ÈçºÎ±£Ö¤Óû§µÄÏìÓ¦ËٶȺͷþÎñÖÊÁ¿£¿ÕâЩÎÊÌⶼÊôÓÚ·þÎñÆ÷ÐÔÄÜÓÅ»¯µÄ·¶³ë¡£×÷Ϊ½Ï³É¹¦µÄÊý¾Ý¿â³§ÉÌ£¬Oracle¹«Ë¾Êý¾Ý¿âµÄÐÔÄÜÓÅ»¯ÊÇÈçºÎ½øÐеÄ
¡¡¡¡ ÓÅ»¯²ßÂÔ
¡¡¡¡ ΪÁ˱£Ö¤OracleÊý ......