Oracle Date Function ½²½âºÍÊÂÀý
http://blog.csdn.net/mustbelove/archive/2007/04/17/1567836.aspx(ת)
1 year=1*12 months
1 day=24
hours=24*(1*60mins)=24*60*(1*60 seconds)
1 week =7 days
×¢Ò⣺
ºÚÉ«×ÖÌåÊÇ oracle
8i£¬9i¶¼¿ÉÒÔʹÓõĺ¯Êý£¬
À¶É«×ÖÌåÊÇ Oracle
9i
ÐÂ
ÔöµÄ²¿·Ö¡£
Çë´ó¼ÒÔÚʹÓÃʱ£¬×¢Òâ°æ±¾ÏÞÖÆ¡£
add_months
current_date
current_timestamp
datimezone
extract(datetime)
last_day
months_between
new_time
next_day
round
SYSDATE
systimestamp
TO_DATE
trunc()
1£º Add_Months
Óï·¨£º
Add_Months(d,n)
º¯Êý -- n¿ÉÕý¿É¸º
×÷Ó㺠Add_Months(d,n) ·µ»ØÈÕÆÚ D ¼ÓÉÏn
ÔµÄÈÕÆÚ
Example:
A£ºÏ¸öÔµĽñÌì
select add_months(sysdate,1) from
dual --ÔÚÔ·ÝÉÏÔö¼Ó
B£ºÉϸöÔµĽñÌì
select add_months(sysdate,-1) from dual
--ÔÚÔ·ÝÉϼõÉÙ
C: ÉϸöÔµÄ×îºóÒ»Ìì
select last_day(add_months(sysdate,-1)) from
dual
2: C
urrent_date
Óï·¨£º
C
urrent_date
×÷Óãº
CURRENT_DATE ·µ»Øµ±Ç°Session ʱÇøµÄµ±Ç°ÈÕÆÚ¡£
Example£º
A£º²»ÌرðÉ趨 oracle
time_zone ÊǺÍϵͳTime_zone Ò»Ö¡£
select current_date,sysdate from dual
SQL> select
current_date,sysdate from dual ;
CURRENT_DATE
SYSDATE
--------------- ---------------
20051109 160535 20051109
160534
B£º
ALTER SESSION SET TIME_ZONE = '-5:0';
SQL> select current_date,sysdate from
dual;
CURRENT_DATE SYSDATE
---------------
---------------
20051109 030644
20051109 160644
3: C
urrent_timestamp
Óï·¨£º
CURRENT_TIMESTAMP
£¨precision)
×÷Óãº
current_timestamp
·µ»Ø´Ësession ËùÔÚʱÇøµÄµ±Ç°ÈÕÆÚºÍʱ¼ä¡£
Êý¾ÝÀàÐÍÊÇ TIMESTAMP
WITH TIME ZONE.
Example:
A£ºdefault
timestamp
SQL> select CURRENT_TIMESTAMP
from dual;
CURRENT_TIMESTAMP
------------------------------------------------------------
09-NOV-05
04.27.41.416811 PM +08:00
B: use precision
SQL> ALTER
SESSION SET TIME_ZONE ='-5:0';
Session altered.
SQL> SELECT
SESSIONTIMEZONE, CURRENT_TIMESTAMP
from DUAL
SESSIONTIMEZONE CURRENT_TIMESTAMP
--------------------
---------------------------------------
-05:00 09-NOV-0
Ïà¹ØÎĵµ£º
¹Ø¼ü×Ö: oracleÊý¾Ý¿â
OracleÊý¾Ý¿âÃüÁ
1¡¢sqlplusÆô¶¯·½Ê½£º
DosÏÂÔËÐÐsqlplus Óû§Ãû/ÃÜÂë as sysdba
ÀýÈ磺c:>sqlplus sys/password AS sydba(ϵͳÕÊ»§)
»òÕߣºc:>sqlplus scott/password
2¡¢Óû§Á¬½Ó(Çл»)²Ù×÷£º
sql>conn Scott/password(ĬÈÏΪtiger)
×¢£ºconnÓëconnectʹÓ÷½·¨Ò» ......
ÔÚʵ¼ÊµÄ¹¤×÷»·¾³ÖУ¬Ðí¶àÈËΪÁËÊÊÓ¦¿Í»§µÄ»·¾³£¬×ÜÊÇÐèҪƵ·±¸ü¸ÄIPµØÖ·£¬µ«ÊÇÔÚIPµØÖ·±ä»»ºó£¬Oracle 10g¾Í»á³öÏÖÆô¶¯²»Á˵ÄÏÖÏó¡£ÍøÉÏÏà¹ØÎÊÌâµÄ¼¼ÊõÎÄÕ´ó¶àÊýÊÇÕë¶ÔOracle 9i£¬»òÕßÒÔÇ°µÄOracle 8iµÄ°æ±¾£¬¶ÔÓëOracle 10gµÄ°æ±¾£¬´ó¶àÖ»ÊǽéÉÜÁË´ó¸Å£¬²¢Ã»Óиø³ö¾ßÌåµÄ²½Öè!±¾ÎÄÖУ¬ÎÒÃǽ«Õë¶ÔÕâÒ»ÎÊÌâ¸ø³ö¾ßÌåµÄ½â¾ö² ......
ÊÕ²Ø×ÔijЩ¸ßÊÖµÄ×ܽᣬ²»¸Ò¶ÀÏí£¬ÓëÓÐÔµÀ´´ËÕß¹²Ïí¡£
-----------------------------------------------------------------------------------
Oracle×Ö·û¼¯ÎÊÌâ×ܽá
¾³£ÓÐͬÊÂ×ÉѯoracleÊý¾Ý¿â×Ö·û¼¯Ïà¹ØµÄÎÊÌ⣬ÈçÔÚ²»Í¬Êý¾Ý¿â×öÊý¾ÝǨÒÆ¡¢Í¬ÆäËüϵͳ½»»»Êý¾ÝµÈ£¬³£³£ÒòΪ×Ö·û¼¯²»Í¬¶øµ¼ÖÂǨÒÆʧ°Ü»òÊý¾Ý¿âÄÚÊý¾Ý±ä³ ......
oracleÆô¶¯·½Ê½ÓëÃüÁî²ÎÊý»ã×Ü
±¾ÎÄÖ÷ÒªÊǶÔoracleµÄÆô¶¯·½Ê½ºÍÏà¹ØµÄÃüÁî²ÎÊý½øÐÐÒ»¸ö»ã×Ü£¬ÓÃÒÔ¼ÓÉîÓ¡Ïó¡£
OracleµÄÆô¶¯·½Ê½£º
startup nomount
startup mount
startup open (startupµÄĬÈÏÑ¡Ïî)
ÆäËû³£ÓõIJÎÊý£ºread only ,read write ,force,restrict
ÕâЩ²ÎÊý¿ÉÒÔÒ»ÆðʹÓÃ,±ÈÈç startup Óë startup open read ......
Oracle ÊÓͼ
ÊÓͼ: Äã¿ÉÒÔͨ¹ý´´½¨±íµÄÊÓͼÀ´±íÏÖÊý¾ÝµÄÂß¼×Ó¼¯»òÊý¾ÝµÄ×éºÏ.ÊÓͼÊÇ»ùÓÚ±í»òÕßÁíÒ»¸ö
ÊÓͼµÄÂß¼±í,Ò»¸öÊÓͼ²¢²»°üº¬Ëü×Ô¼ºµÄÊý¾Ý,ËüÏóÒ»¸ö´°¿Ú,ͨ¹ý¸Ã´°¿Ú¿ÉÒԲ鿴»ò¸Ä±ä
  ......