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

Oracleѧϰ±Ê¼ÇÖ®ÈÕÆÚº¯Êý

OracleÈÕÆÚº¯Êýѧϰʱ£¬Ôڽ̳ÌÓм¸¸öʵÀýÈçÏ£º
Months_between(’01-sep-95’, ’11-jan-94’)
½á¹ûÊÇ£º19.6774194

Add_months ÔÚÖ¸¶¨µÄÔ·ÝÉÏÃæÔö¼ÓÏàÓ¦µÃÔ·Ý
ÀýÈ磺
Add_months(’11-jan-94’, 6)
½á¹ûÊÇ£º11-jul-94

Next_day ¼ÆËã¹æ¶¨ÈÕÆڵĺóÒ»¸öÌض¨ÈÕÆÚ
ÀýÈ磺
Next_day(’01-sep-95’, ‘Friday’ )
½á¹ûÊÇ£º
08-sep-95

Last_day Ö¸Õâ¸öÔÂ×îºóÒ»Ìì
ÀýÈ磺
Last_day(’01-feb-95’) 
È»¶øÔÚSQL*plusÊäÈëÕâЩº¯ÊýÖ´ÐÐʱ£¬È´×ܵò»µ½ÕýÈ·µÄ½á¹û£¬ÒòΪÈÕÆڵĸñʽÎÞ·¨Ê¶±ð¡£ÕýÈ·µÄÓ÷¨Ó¦¸ÃÈçÏ£º
select MONTHS_BETWEEN('24-2ÔÂ-2010','24-2ÔÂ-2010') from dual¡£ÕâÑùдºÜ²»·½±ã£¬ÎªÁ˱ÜÃâ³öÏÖÕâÑùµÄÎÊÌ⣬ÔÚ×Ô¼ºÊéдÈÕÆÚʱ£¬×îºÃÓÃ×Ô¼ºÏ²»¶µÄ·½Ê½Êéд£¬²¢ÓÃto_dateº¯ÊýÖ¸¶¨¸ñʽÈ磺
select MONTHS_BETWEEN(to_date('20100224','yyyymmdd'),to_date('20100524','yyyymmdd')) from dual 
ÕâÀïÉæ¼°µ½Ò»¸öto_dateº¯Êý£¬Ëü½«ÊäÈëµÄ×Ö·û´®ÐòÁУ¬×ª»»ÎªÖ¸¶¨¸ñʽµÄÈÕÆÚº¯Êý£¬Óɴ˿ɵÃÆäËü¸üΪȫÃæµÄʵÀýΪ£¨ÒÔϲ¿·ÖÕª×Ôhttp://blog.csdn.net/sxpyrgz£©£º
1.ADD_MONTHS
Ôö¼Ó»ò¼õÈ¥Ô·Ý
SQL> select to_char(add_months(to_date('199912','yyyymm'),2),'yyyymm') from dual;
TO_CHA
------
200002
SQL> select to_char(add_months(to_date('199912','yyyymm'),-2),'yyyymm') from dual;
TO_CHA
------
199910
2.LAST_DAY
·µ»ØÈÕÆÚµÄ×îºóÒ»Ìì
SQL> select to_char(sysdate,'yyyy.mm.dd'),to_char((sysdate)+1,'yyyy.mm.dd') from dual;
TO_CHAR(SY TO_CHAR((S
---------- ----------
2004.05.09 2004.05.10
SQL> select last_day(sysdate) from dual;
LAST_DAY(S
----------
31-5ÔÂ -04
3.MONTHS_BETWEEN(date2,date1)
¸ø³ödate2-date1µÄÔ·Ý
SQL> select months_between('19-12ÔÂ-1999','19-3ÔÂ-1999') mon_between from dual;
MON_BETWEEN
-----------
9
SQL>selectmonths_between(to_date('2000.05.20','yyyy.mm.dd'),to_date('2005.05.20','yyyy.mm.dd')) mon_betw from dual;
MON_BETW
---------
-60
×¢£ºSELECT months_between(SYSDATE, sysdate) same,
months_between(SYSDATE, add_months(sysdate, -1)) big,
months_between(SYSDATE, add_months(sysdate


Ïà¹ØÎĵµ£º

OracleÖеĴø²ÎÊýµÄÊÓͼ

OracleµÄÊÓͼ²»Ö§³Ö²ÎÊý
ÕâÀïÓÐÒ»¸öÁíÀàµÄ·½·¨£¬²»ÊǺܺ㬵«ÊÇ»¹ÊÇÒ»ÖÖ½â¾ö·½°¸
ͨ¹ýpackageʵÏÖ
create or replace package pkg_pv is
¡¡¡¡procedure set_pv(pv varchar2);
¡¡¡¡function get_pv return varchar2;
¡¡¡¡end;
¡¡¡¡create or replace package body pkg_pv is
¡¡¡¡v varchar2(20);
¡¡¡¡procedure set ......

oracleÊý¾ÝÎļþ»Ö¸´

1.    ×¼±¸¹¤×÷
°Ñ¾ÉµÄORACLEËùÓÐÎļþ¶¼COPY±¸·ÝÏÂÀ´,ɾ³ý¾ÉĿ¼,ÔÙÖØа²×°ORACLE,Ŀ¼ºÍ¾ÉĿ¼һÑù(Èç¹û²»Ò»Ñù,ÒªÐ޸ĵĵط½±È½Ï¶à).Ö»°²×°ORACLE,²»´´½¨Êý¾Ý¿â¡£Òª»Ö¸´µÄʵÀýΪORCL ¡£
2.ÓÃÃüÁʽ£¬Í¨¹ýÒª¾ÉµÄORAÎļþ´´½¨ÐµÄʵÀýORCL
a)     oradim -new -sid ORCL£¨´´½¨ÊµÀý£ ......

oracle µÄ left/right joinÓë(+)µÄÒ»¸öÇø±ð

»ù±¾´ÓÀ´²»ÓÃleft/right join
Ò»¸öÏîÄ¿±»ÆÈÒªÓñðÈËдµÄ sql
±¾´òËã¸ÄдһÏ£¬Ìá¸ßЧÂÊ
·¢ÏÖ£º
¡¾1¡¿
select * from  a
left outer join  b on a.id= b.id AND ...1...
 where ...2...
Óë
¡¾2¡¿
select * from  a , b 
 where a.id= b.id(+)
A ......

oracle Function


5.µ÷Óú¯ÊýFN_ADDONE
--------------------
SQL> SET SERVEROUTPUT ON
SQL> DECLARE CNUM NUMBER;
  2  BEGIN
  3     CNUM := USER1_ADB.FN_ADDONE(3);
  4     DBMS_OUTPUT.PUT_LINE('CNUM = ' || CNUM);
  5  END;
  6&nbs ......

ÐÞ¸ÄOracle 10g SGA ´óС

ʹÓÃSYSÓû§ÒÔSYSDBAÉí·ÝµÇ¼ϵͳ
²é¿´ÐÞ¸ÄÇ°sga_max_size£¬sga_target´óС
show parameter sga_max_size;
show parameter sga_target;
Ð޸IJÎÊý
alter system set sga_max_size=1600m scope=spfile;
alter system set sga_target=1600m scope=spfile;
²é¿´Ð޸ĺósga_max_size£¬sga_target´óС
show parameter sga_ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ