oracleµÄһЩ»ù±¾Óï·¨ºÍһЩÓÅ»¯ÎÊÌâ
²éѯ£º
select distinct(empno) , name , age from t_person t where (t.age between 21 and 25 or name like '%Íõ%') and
empno like '32%';
¸üУº
update t_person set name = 'ww' where empno = '321654';
update t_person set(empno,name,age) = (select empno,name,age from t_person1 where ...)
²åÈ룺
insert into t_person values(seq_person.nextval,'ww',21); -- seq_person.currval µ±Ç°ÐòÁÐÖеÄÖµ
insert into t_person(empno,name) values('321654','ww');
ɾ³ý£º
delete t_person <==> delete from t_person
´´½¨±í£º
create table t_person (
empno varchar2(6),
name varchar2(20),
age int ,
constraint pk_person primary key(empno)
);
comment on table t_person is 'Ô±¹¤±í';
comment on column empno is 'Ô±¹¤±àºÅ';
comment on column name is 'Ô±¹¤ÐÕÃû';
comment on column age is 'Ô±¹¤ÄêÁä';
create table t_person as select * from t_person1 where 1<>1; Ö»¸´ÖƱí½á¹¹
create table t_person as select * from t_person1 where 1=1; ¸´ÖƱí½á¹¹ºÍÊý¾Ý£¨¿½±´£©£¬µ«³ýÁË·Ç¿ÕÔ¼ÊøÄܱ»¸´ÖÆ£¬ÆäËüµÄÔ¼Êø¶¼²»ÄÜ¿½±´¡£
´´½¨ÊÓͼ£º
create view v_person as select * from t_person t left join t_person1 m on t.empno = m.empno where ...;
½ØÈ¡×Ö·û´®£º
select substr('wangwei',2,3) from dual; --´ÓµÚ¶þλ¿ªÊ¼½ØÈ¡È¡Èý¸ö×Ö·û£¨×¢Òâ:Êý¾Ý¿âÖеÄÊÇ´Ó1¿ªÊ¼µÄ£¬¶ø²»ÊÇ0£©
dbms_output.put_line :ang
¼ÆË㳤¶ÈµÄº¯Êý£º
select length('wangwei') from dual; --dbms_output.put_line:7
¼ÆËã×ÜÁ¿µÄº¯Êý£º
select count(1) from t_person; -- ´ËÓï¾äµÄÖ´ÐÐЧÂʱȷÇË÷Òý×ֶεÄЧÂʵÍ
select count(*) from t_person; -- ´ËÓï¾äµÄÖ´ÐÐЧÂʱȷÇË÷Òý×ֶεÄЧÂʵͣ¬±ÈµÚÒ»¸öµÄЧÂʵÍһЩ¡£
select count(name) from t_person; -- ´ËÓï¾äµÄÖ´ÐÐЧÂÊÊÇ×îµÍµÄ£¬Ç°ÌáÌõ¼þÊÇname×ֶβ»ÊÇË÷Òý¡£
select count(empno) from t_person; --´ËÓï¾äµÄÖ´ÐÐЧÂÊ×î¸ß£¬Ç°ÌáÊÇempno×Ö¶ÎÊÇË÷Òý¡£
ÔÚÆ´½ÓsqlÓï¾äµÄʱºò£¬Ò»¶¨Òª×¢Òâ×Ö·û´®ºÍ¿Õ¸ñµÄÎÊÌ⣬±ÈÈ磺
String sql = "select * from t_person t where
Ïà¹ØÎĵµ£º
OracleÐÔÄÜÓÅ»¯¼¼ÇÉ
http://tech.it168.com/db/o/2006-06-15/200606151715426.shtml
1.Ñ¡ÓÃÊʺϵÄORACLEÓÅ»¯Æ÷
ORACLEµÄÓÅ»¯Æ÷¹²ÓÐ3ÖÖ:
1.RULE(»ùÓÚ¹æÔò) 2.COST(»ùÓڳɱ¾) 3.CHOOSE(Ñ¡ÔñÐÔ)
ÉèÖÃȱʡµÄÓÅ»¯Æ÷,¿ÉÒÔͨ¹ý¶Ôinit.oraÎļþÖÐOPTIMIZER_MODE²ÎÊ ......
Éó¼ÆÊÓͼ
STMT_AUDIT_OPTION_MAP -- Éó¼ÆÑ¡ÏîÀàÐÍ´úÂë
AUDIT_ACTIONS -- action´úÂë
ALL_DEF_AUDIT_OPTS -- ¶ÔÏó´´½¨Ê±Ä¬ÈϵĶÔÏóÉó¼ÆÑ¡Ïî
DBA_STMT_AUDIT_OPTS -- µ±Ç°Êý¾Ý¿âϵͳÉó¼ÆÑ¡Ïî
DBA_PRIV_AUDIT_OPTS -- ȨÏÞÉó ......
OracleÔÚÖ´ÐÐÒ»¸öSQL֮ǰ,Ê×ÏÈÒª·ÖÎöÒ»ÏÂÓï¾äµÄÖ´Ðмƻ®,È»ºóÔÙ°´Ö´Ðмƻ®È¥Ö´ÐС£·ÖÎöÓï¾äµÄÖ´Ðмƻ®µÄ¹¤×÷ÊÇÓÉÓÅ»¯Æ÷(Optimizer)À´Íê³ÉµÄ¡£²»Í¬µÄÇé¿ö,Ò»ÌõSQL¿ÉÄÜÓжàÖÖÖ´Ðмƻ®,µ«ÔÚijһʱµã,Ò»¶¨Ö»ÓÐÒ»ÖÖÖ´Ðмƻ®ÊÇ×îÓŵÄ,»¨·Ñʱ¼äÊÇ×îÉٵġ£ÏàÐÅÄãÒ»¶¨»áÓÃPl/sql Developer¡¢ToadµÈ¹¤¾ßÈ¥¿´Ò»¸öÓï¾äµÄÖ´Ðмƻ®,²»¹ýÄã ......
1. NLS_LANG
²ÎÊý×é³É
NLS_LANG
²ÎÊýÓÉÒÔϲ¿·Ö×é³É:
NLS_LANG
=<Language>_<Territory>.<Clients
Characterset>
NLS_LANG
¸÷²¿·Öº¬ÒåÈçÏÂ:
LANGUAGEÖ¸¶¨:
-OracleÏûϢʹÓõÄÓïÑÔ
-ÈÕÆÚÖÐÔ·ݺÍÈÕÏÔʾ
TERRITORYÖ¸¶¨
-»õ±ÒºÍÊý×Ö¸ñʽ
-µØÇøºÍ¼ÆËãÐÇÆÚ¼°ÈÕÆÚµÄÏ°¹ß
CHARACTERSET:
-¿Ø ......
Oracleʱ¼äÈÕÆÚ²Ù×÷
sysdate+(5/24/60/60) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ãë
sysdate+5/24/60 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5·ÖÖÓ
sysdate+5/24 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Сʱ
sysdate+5 ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Ìì
add_months(sysdate,-5) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5ÔÂ
add_months(sysdate,-5*12) ÔÚϵͳʱ¼ä»ù´¡ÉÏÑÓ³Ù5Äê
ÉÏÔÂÄ©µÄÈÕÆÚ£ºsel ......