OracleÈÕÆÚº¯Êý¼¯½õ(Èý)
OracleÈÕÆÚº¯Êý¼¯½õ(Èý)
Èý¡¢Ò»Ð©Êµ¼ùºóµÄÓ÷¨£º
1.ÉÏÔÂÄ©Ì죺
select to_char(add_months(last_day(sysdate),-1),'yyyy-MM-dd') LastDay from dual£»
2.ÉÏÔ½ñÌì
SQL> select to_char(add_months(sysdate,-1),'yyyy-MM-dd') PreToday from dual;
3.ÉÏÔÂÊ×Ìì
SQL> select to_char(add_months(last_day(sysdate)+1,-2),'yyyy-MM-dd') firstDay from dual;
4.ÒªÕÒµ½Ä³ÔÂÖÐËùÓÐÖÜÎåµÄ¾ßÌåÈÕÆÚ
SELECT to_char(b.a,'YY-MM-DD')
from ( SELECT trunc(SYSDATE,'mm')+ROWNUM-1 a
from dba_objects where rownum < 32 ) b
WHERE to_char(b.a,'day')='ÐÇÆÚÎå';
Èç¹û°Ñwhere to_char(t.d, 'MM') = to_char(sysdate, 'MM')¸Ä³Ésysdate-90£¬¼´Îª²éÕÒµ±Ç°Ô·ݵÄÇ°Èý¸öÔÂÖÐ
µÄÿÖÜÎåµÄÈÕÆÚ¡£
5.µÃµ½ÏµÍ³µ±Ç°Ô¼°ÒÔºóµÄÈÕÆÚ
select trunc(sysdate, 'MM')+ROWNUM-1 from dba_objects ;
-----------------------------------
to_date ×Ö·û´®ÀàÐÍתΪ»»ÈÕÆÚÀàÐÍ
×Ö·û´®ÖеÄÏàӦλÖÃÉϵÄ×Ö·û,±ØÐë·ûºÏʱ¼ä·¶Î§µÄÏÞÖÆ
14.MI ·ÖÖÓÊý(0¡«59)
ÌáʾעÒâ²»Òª½«MM¸ñʽÓÃÓÚ·ÖÖÓ(·ÖÖÓÓ¦¸ÃʹÓÃMI)¡£MMÊÇÓÃÓÚÔ·ݵĸñʽ£¬½«ËüÓÃÓÚ·ÖÖÓÒ²Äܹ¤×÷£¬µ«½á¹ûÊÇ´íÎóµÄ¡£
15.SS ÃëÊý(0¡«59)
Ïà¹ØÎĵµ£º
OracleÖг£ÓõÄÃüÁîºÍº¯Êý£¬×ö¸öÕûÀí£¬ÒÔ±¸ÒÔºóÓõ½£¬·½±ã²éÔÄ¡£
³£ÓÃÃüÁ
Á¬½Ósqlplus
ÃüÁîÐÐÏÂÔËÐÐcmd½øÈ룬ÈçÒÔsysģʽµÇ½£¬ÃüÁîÈçÏ£º
(1).sqlplus "sys/zhb126 as sysdba"
(2).sqlplus/nolog connect sys/zhb126 as sysdba
(3).sqlplus scott ......
OracleÖд´½¨Í¬Òå´ÊÓï¾ä£º
create synonym table_name for user.table_name;
ÆäÖеÚÒ»¸öuser_tableºÍµÚ¶þ¸öuser_table¿ÉÒÔ²»Ò»Ñù¡£
´ËÍâÈç¹ûÒª´´½¨Ò»¸öÔ¶³ÌµÄÊý¾Ý¿âÉϵÄijÕűíµÄͬÒå´Ê£¬ÐèÒªÏÈ´´½¨Ò»¸öDatabase Link£¨Êý¾Ý¿âÁ¬½Ó£©À´À©Õ¹·ÃÎÊ£¬È»ºóÔÚʹÓÃÈçÏÂÓï¾ä´´½¨Êý¾Ý¿âͬÒå´Ê£ºcreate synonym tabl ......
±í´Ø£¨table cluster)ÊÇÒ»¸öÊý¾Ý¿â¶ÔÏó£¬Ëü¿ÉÒÔ½«ÄÇЩ¾³£ÔÚÏàͬÊý¾Ý¿éÖÐÒ»ÆðʹÓõıí½øÐÐÎïÀí·Ö×é¡£µ±Äã´¦ÀíÄÇЩ¾³£Á¬½ÓÔÚÒ»Æð½øÐвéѯµÄ±íʱ£¬±í´ØÊÇÌرðÓÐЧµÄ¡£Ò»¸ö±í´Ø´æ´¢´Ø¼ü£¨ÓÃÓÚ½«±íÁ¬½Óµ½Ò»ÆðµÄÁУ©£¬ÒÔ¼°´Ø±íÖеÄÁÐÖµ¡£ÒòΪ´ØÖÐµÄ±í¶¼±»´¢´æÔÚÏàͬµÄÊý¾Ý¿â¿éÖУ¬ËùÒÔʹÓôع¤×÷ʱ£¬I/O²Ù×÷¾Í¼õÉÙÁË¡£
......
Êý¾Ý¿âÊÇÒ»¸ö¶àÓû§Ê¹ÓõĹ²Ïí×ÊÔ´¡£µ±¶à¸öÓû§²¢·¢µØ´æÈ¡Êý¾Ýʱ£¬ÔÚÊý¾Ý¿âÖоͻá²úÉú¶à¸öÊÂÎñͬʱ´æȡͬһÊý¾ÝµÄÇé¿ö¡£Èô¶Ô²¢·¢²Ù×÷²»¼Ó¿ØÖƾͿÉÄÜ»á¶ÁÈ¡ºÍ´æ´¢²»ÕýÈ·µÄÊý¾Ý£¬ÆÆ»µÊý¾Ý¿âµÄÒ»ÖÂÐÔ¡£
¼ÓËøÊÇʵÏÖÊý¾Ý¿â²¢·¢¿ØÖƵÄÒ»¸ö·Ç³£ÖØÒªµÄ¼¼Êõ¡£µ±ÊÂÎñÔÚ¶Ôij¸öÊý¾Ý¶ÔÏó½øÐвÙ×÷Ç°£¬ÏÈÏòϵͳ·¢³öÇëÇ󣬶ÔÆä¼ÓËø¡£¼ÓËøº ......
SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
A A ZERO SPACE
--------- --------- -- ......