oracleÖг£Óú¯Êý´óÈ«
1¡¢ÊýÖµÐͳ£Óú¯Êý
¡¡
¡¡º¯Êý¡¡¡¡·µ»ØÖµ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÑùÀý¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÔʾ
ceil(n) ´óÓÚ»òµÈÓÚÊýÖµnµÄ×îСÕûÊý¡¡¡¡select ceil(10.6) from dual; 11
floor(n) СÓÚµÈÓÚÊýÖµnµÄ×î´óÕûÊý¡¡ select ceil(10.6) from dual; 10
mod(m,n) m³ýÒÔnµÄÓàÊý,Èôn=0,Ôò·µ»Øm select mod(7,5) from dual; 2
power(m,n) mµÄn´Î·½¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ select power(3,2) from dual; 9
round(n,m) ½«nËÄÉáÎåÈë,±£ÁôСÊýµãºómλ¡¡¡¡select round(1234.5678,2) from dual; 1234.57
sign(n) Èôn=0,Ôò·µ»Ø0,·ñÔò,n>0,Ôò·µ»Ø1,n<0,Ôò·µ»Ø-1 select sign(12) from dual; 1
sqrt(n) nµÄƽ·½¸ù¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡select sqrt(25) from dual ; 5
2¡¢³£ÓÃ×Ö·ûº¯Êý
initcap(char) °Ñÿ¸ö×Ö·û´®µÄµÚÒ»¸ö×Ö·û»»³É´óд¡¡¡¡select initicap('mr.ecop') from dual; Mr.Ecop
lower(char) Õû¸ö×Ö·û´®»»³ÉСд¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡select lower('MR.ecop') from dual; mr.ecop
replace(char,str1,str2) ×Ö·û´®ÖÐËùÓÐstr1»»³Éstr2 select replace('Scott','s','Boy') from dual; Boycott
substr(char,m,n) È¡³ö´Óm×Ö·û¿ªÊ¼µÄn¸ö×Ö·ûµÄ×Ó´®¡¡¡¡select substr('ABCDEF',2,2) from dual; CD
length(char) Çó×Ö·û´®µÄ³¤¶È¡¡¡¡¡¡¡¡select length('ACD') from dual; 3
|| ²¢ÖÃÔËËã·û¡¡¡¡¡¡ select 'ABCD'||'EFGH' from dual; ABCDEFGH
3¡¢ÈÕÆÚÐͺ¯Êý
sysdate µ±Ç°ÈÕÆÚºÍʱ¼ä select sysdate from dual;
last_day ¡¡±¾ÔÂ×îºóÒ»Ìì select last_day(sysdate) from dual;
add_months(d,n)¡¡µ±Ç°ÈÕÆÚdºóÍÆn¸öÔ select add_months(sysdate,2) from dual;
months_between(d,n) ÈÕÆÚdºÍnÏà²îÔÂÊý select months_between(sysdate,to_date('20020812','YYYYMMDD')) from dual;
next_day(d,day) dºóµÚÒ»ÖÜÖ¸¶¨dayµÄÈÕÆÚ select next_day(sysdate,'Monday') from dual;
day ¸ñʽ¡¡¡¡ÓС¡¡¡'Monday' ÐÇÆÚÒ»¡¡¡¡'Tuesday' ÐÇÆÚ¶þ
'wednesday' ¡¡ÐÇÆÚÈý 'Thursday' ÐÇÆÚËÄ 'Friday' ÐÇÆÚÎå
'Saturday' ÐÇÆÚÁù 'Sunday' ÐÇÆÚÈÕ
4¡¢ÌØÊâ¸ñʽµÄÈÕÆÚÐͺ¯Êý
Y»òYY»òYYY ÄêµÄ×îºóһ룬Á½Î»£¬Èýλ select to_char(sysdate,'YYY') from dual;
Q ¼¾¶È,1-3ÔÂΪµÚÒ»¼¾¶È¡¡¡¡¡¡¡¡select to_char(sysdate,'Q') from dual;
MM ¡¡Ô·ÝÊý¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡select to_char(sysdate,'MM') from dual;
RM Ô·ݵÄÂÞÂ
Ïà¹ØÎĵµ£º
¹ØÓÚ°²×°£º
°²×°Oracle10gʱ£¬ËùÊäÈëµÄÈ«¾ÖµÄSIDÃû³ÆΪtest(¼´Êý¾Ý¿âÃû£¬²»ÄÜ×÷ΪÓû§ÃûÀ´µÇ¼)£¬ÃÜÂëΪtest(¸ÃÃÜÂë¶ÔÓ¦µÄÓû§Îªsystem£¬sysµÈ)¡£
×°Íêºó£¬Èô´ÓÍøÒ³ÉϵǼoracle£¬ÔòÊäÈëurl£ºhttp://localhost:1158/em
ÈôÎÞ·¨ÏÔ ......
±¾ÉíÕâ¸ö²½ÖèºÜ¶à¸ßÊÖ¶¼ÒѾÌù¹ýÁË£¬Ö»ÊÇÎÒÔÚʹÓÃÖз¢ÏÖ´óÌåÉÏ´ó¼ÒдµÄ¶¼ÓÐЩ¸´ÔÓ£¬ÓÚÊÇ£¬ÎÒ×ܽáÁ˸ö³¬¼¶¼ò»¯°æµÄ£¬·½±ã´ó¼ÒʹÓãº
1.°²×°LOGMNR°ü£¬ÐèÒª±¾²½Öèûʲô¿É¶à˵µÄ£¬Ö»ÊÇÐèҪעÒâÔÚÁ¬½ÓÊý¾Ý¿âµÄʱºòĬÈÏ×îºÃʹÓñ¾µØÑéÖ¤·½Ê½
C:\>sqlplus /nolog
SQL> conn / as sysdba
SQL> @D:\oracle\product\10 ......
»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......
ÔÎĵØÖ·£ºhttp://guyuanli.itpub.net/post/37743/484763
ÿÌì1µãÖ´ÐеÄoracle JOBÑùÀý
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job =>
X,
what => 'ETL_RUN_D_Date;',
next_date => to_date('2009-08-26
01:00:00','yyyy-mm-dd hh24:mi:ss'),
interval =>
'trunc(sysdate)+1+1/24',
n ......
select * from user_recyclebin where original_name like 'FINANCE_%' order by droptime desc;
FLASHBACK TABLE FINANCE_CASE_FEE_ITEM TO BEFORE DROP
¼´ËùÓÐdropµÄ±í¶¼ÔÚ user_recyclebin Õâ¸öoracle»ØÊÕÕ¾ÀïÃæµÄ£¬ÔÙͨ¹ýflashbackÃüÁԼ´¿É¡£
¿´ÁËÍøÉÏ»¹¿ÉÒÔͨ¹ýµ÷Õûoracleʱ¼ä £¬»Øµ½É¾³ýµÄÄ ......