Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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 values('200202',


Ïà¹ØÎĵµ£º

oracle ÊÓƵ±Ê¼Ç3(insert¡¢update¡¢delete)

Ò»,INSERT
1.ΪÁ˲»´òÂÒÔ­À´µÄ±íµÄÊý¾Ý,ËùÒÔ±¸·ÝÔ­À´µÄÊý¾Ý.
create table emp2 as select * from emp
create table emp3 as select * from emp
create table dept2 as select * from dept
create table salgrade2 as select * from salgrade
2.²é¿´±íµÄÉè¼ÆÇé¿ö:desc dept2;±íʾ²é¿´±ídept2µÄÉè¼ÆÇé¿ö.
3.²åÈëÊý¾Ýµ ......

ORACLE ROLLUPºÍCUBEµÄʹÓÃ

ROLLUP£¬ÊÇGROUP BY×Ó¾äµÄÒ»ÖÖÀ©Õ¹£¬¿ÉÒÔΪÿ¸ö·Ö×é·µ»ØС¼Æ¼Ç¼ÒÔ¼°ÎªËùÓзÖ×é·µ»Ø×ܼƼǼ¡£
CUBE£¬Ò²ÊÇGROUP BY×Ó¾äµÄÒ»ÖÖÀ©Õ¹£¬¿ÉÒÔ·µ»Øÿһ¸öÁÐ×éºÏµÄС¼Æ¼Ç¼£¬Í¬Ê±ÔÚĩβ¼ÓÉÏ×ܼƼǼ¡£
ÔÚÎÄÕµÄ×îºó¸½ÉÏÁËÏà¹Ø±íºÍ¼Ç¼´´½¨µÄ½Å±¾¡£
1¡¢ÏòROLLUP´«µÝÒ»ÁÐ
SQL> select division_id,sum(salary)
  2  ......

110¸öoracle³£Óú¯Êý×ܽá

 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
¸ø³öÕûÊý,·µ»Ø¶ÔÓ¦µÄ×Ö·û;
SQL> select chr(54740) zhao,chr(65) chr65 from dual;
ZH ......

Oracle SQLÓï¾ä²Ù×÷Êý×Ö£ºÈ¡Õû¡¢ËÄÉáÎåÈë¼°¸ñʽ»¯

 http://cheneyph.javaeye.com/blog/453492
ÓÃoracle sql¶ÔÊý×Ö½øÐвÙ×÷: È¡ÉÏÈ¡Õû¡¢ÏòÏÂÈ¡Õû¡¢±£ÁôNλСÊý¡¢ËÄÉáÎåÈë¡¢Êý×Ö¸ñʽ»¯
È¡Õû£¨ÏòÏÂÈ¡Õû£©£º 
select floor(5.534) from dual;
select trunc(5.534) from dual;
ÉÏÃæÁ½ÖÖÓ÷¨¶¼¿ÉÒÔ¶ÔÊý×Ö5.534ÏòÏÂÈ¡Õû£¬½á¹ûΪ5.
Èç¹ûÒªÏòÉÏÈ¡Õû £¬µÃµ½½á¹ûÎ ......

oracleË÷ÒýµÄÈÏʶ

 
 
   
 
       Ë÷Òý( Index )Êdz£¼ûµÄÊý¾Ý¿â¶ÔÏó£¬ËüµÄÉèÖúûµ¡¢Ê¹ÓÃÊÇ·ñµÃµ±£¬¼«´óµØÓ°ÏìÊý¾Ý¿âÓ¦ÓóÌÐòºÍDatabase µÄÐÔÄÜ¡£ËäÈ»ÓÐÐí¶à×ÊÁϽ²Ë÷ÒýµÄÓ÷¨£¬ DBA ºÍ Developer ÃÇÒ²¾­³£ÓëËü´ò½»µÀ£¬µ«±ÊÕß·¢ÏÖ£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ