ORACLE ³£ÓÃ×Ö·ûº¯Êý
1.LOWER(str) Ç¿ÖÆСд
2.UPPER(str) Ç¿ÖÆ´óд
3.INITCAP(str) ÿ¸öµ¥´ÊÊ××Öĸ´óд
ʾÀý£º
SQL> select initcap('my_boy') from dual; --·µ»Ø"My_Boy"
×¢Ò⣺µ¥´ÊÖ®¼äÓÃÏ»®Ïߣ¨"_"£©·Ö¸î
4.CONCAT(str1,str2£©Á¬½Óº¯Êý,Á¬½Óstr1ºÍstr2×Ö·û´®
5.SUBSTR(string,a[,b])·µ»ØstringµÄÒ»²¿·Ö£¬aºÍbÒÔ×Ö·ûΪµ¥Î»¡£´Ó×Ö·ûλÖÃa¿ªÊ¼£¬³¤Îªb¸ö×Ö·û¡£Èç¹ûaÊÇ0£¬ÄÇËü¾Í±»ÈÏΪÊÇ1£¨×Ö·û´®µÄ¿ªÊ¼Î»Öã©¡£Èç¹ûaÊÇÕýÊý£¬ÄÇô×Ö·û´Ó×ó±ß¿ªÊ¼Êý¡£Èç¹ûÊǸºÊý£¬Ôò´ÓSTRINGµÄĩβ¿ªÊ¼£¬´ÓÓÒ±ßÊý¡£Èç¹ûb²»´æÔÚ£¬ÄÇôȱʡÊÇÕû¸ö×Ö·û´®¡£Èç¹ûbСÓÚ1£¬½«·µ»ØNULL¡£Èç¹ûa»òbʹÓÃÁ˸¡µãÊý£¬ÄÇô¸ÃÊýÖµÊ×Ïȱ»½ÚÈ¡³ÉÒ»¸öÕûÊý£¬·µ»ØÀàÐÍÓëSTRINGÏàͬ¡£
ʾÀý£º
SQL> select substr('abcde',1,2) from dual; --·µ»Ø"ab"
5.LENGTH(str£©·µ»ØstringµÄ³¤¶È¡£ÒòΪCHARÀàÐ͵ÄÖµÊÇÌî³ä¿Õ¸ñµÄ£¬ËùÒÔÈç¹ûstringÊÇCHARÊý¾ÝÀàÐÍ£¬ÄÇôĩβµÄ¿Õ¸ñËãÔÚ³¤¶ÈÖ®ÄÚ¡£Èç¹ûstringÊÇNULL£¬º¯Êý·µ»ØNULL¡£
ʾÀý£º
SQL> select length('a b c ') from daul; --·µ»Ø6
SQL> select length(null) from dual; --·µ»ØNULL
6.INSTR(string1,string2[,a][,b]) ·µ»Østring1Öаüº¬string2µÄλÖá£aºÍbÒÔ×Ö·ûΪµ¥Î»¡£´Ó×ó±ß¿ªÊ¼É¨Ãèstring1,ÆðʼλÖÃÊÇA¡£Èç¹ûAΪ¸ºÊýÄÇô´ÓÓұ߿ªÊ¼É¨Ãè¡£µÚB´Î³öÏÖµÄλÖý«±»·µ»Ø¡£AºÍBȱʡ¶¼Îª1£¬¼´·µ»ØÔÚstring1ÖеÚÒ»´Î³öÏÖstring2µÄλÖá£Èç¹ûstring2ÔÚAºÍBµÄ¹æ¶¨ÏÂûÓÐÕÒµ½ÄÇô¾Í·µ»Ø0¡£Î»ÖõļÆËãÊÇÏà¶ÔÓÚstring1µÄ¿ªÊ¼Î»Öõģ¬¶ø²»¹ØAºÍBµÄÈ¡Öµ¡£
ʾÀý£º
SQL> select instr('abcbe','b',1,2) from dual; --·µ»Ø4
SQL> select instr('abcbe','b',3) from dual; --·µ»Ø4
SQL> select instr('abcbe','d') from dual; --·µ»Ø0
7.LPAD£¨ÁÐÃû,Êý×Ö,‘Òª²¹ÉϵÄ×Ö·û'£©×ó²¹Î»
ʾÀý£º
SQL> select lpad('abc',5,'#') from dual; --·µ»Ø##abc
8.RPAD£¨ÁÐÃû£¬Êý×Ö£¬'Òª²¹ÉϵÄ×Ö·û'£©ÓÒ²¹Î»
ʾÀý£º
SQL> select rpad('abc',5,'#') from dual; --·µ»Øabc##
9.TRIM('child_str’from‘parents_str') ½«Á¬Ðø×Ó´®£¨Ö»ÄÜÓÐÒ»¸ö×Ö·û£©´ÓÖ÷´®µÄÁ½±ß½ØÈ¡³öÀ´£¬Çø·Ö´óСд¡£Ä¬ÈÏΪ½ØÈ¡¿Õ¸ñ¡£Trim(str)È¥µôstrÇ°ºó¿Õ¸ñ¡£
ʾÀý£º
SQL> select trim('a' from 'aba') from dual; --·µ»Øb
SQL> select trim(' bbb ') from dual; --·µ»Øbbb
10.LTRIM(str) ×ó½ØÈ¡
11.RTRIM(str) ÓÒ½ØÈ¡
12.REPLACE(x,y[,z]) ·µ»Ø
Ïà¹ØÎĵµ£º
1)Library CacheµÄÃüÖÐÂÊ:
.¼ÆË㹫ʽ:Library Cache Hit Ratio = sum(pinhits) / sum(pins)
SQL>SELECT SUM(pinhits)/sum(pins) from V$LIBRARYCACHE;
ͨ³£ÔÚ98%ÒÔÉÏ£¬·ñÔò£¬ÐèÒªÒª¿¼ÂǼӴó¹²Ïí³Ø£¬°ó¶¨±äÁ¿£¬ÐÞ¸Äcursor_sharingµÈ²ÎÊý¡£
2)¼ÆËã¹²Ïí³ØÄÚ´æʹÓÃÂÊ:
SQL>SELECT ......
1¡¢set linesize 100; ÉèÖó¤¶È
2¡¢set pagesize 30; ÉèÖÃÿҳÏÔʾÊýÄ¿
3¡¢em a.sql ´ò¿ª¼Çʱ¾
4¡¢@ a Ö´ÐÐÎļþaÖеĴúÂ룬¿ÉÖ¸¶¨ÎļþµÄ·¾¶ @d:a.txt ......
Êý¾Ý¿âÃû(DB_NAME)¡¢ÊµÀýÃû(Instance_name)¡¢ÒÔ¼°²Ù×÷ϵͳ»·¾³±äÁ¿(ORACLE_SID)
ÔÚORACLE7¡¢8Êý¾Ý¿âÖÐÖ»ÓÐÊý¾Ý¿âÃû(db_name)ºÍÊý¾Ý¿âʵÀýÃû(instance_name)¡£ÔÚORACLE8i¡¢9iÖгöÏÖÁËеIJÎÊý£¬¼´Êý¾Ý¿âÓòÃû(db_domain)¡¢·þÎñÃû(service_name)¡¢ÒÔ¼°²Ù×÷ϵͳ»·¾³±äÁ¿(ORACLE_SID)¡£ÕâЩ¶¼´æÔÚÓÚͬһ¸öÊý¾Ý¿âÖеıêʶ£¬ÓÃÓÚÇ ......
ʹÓÃscott/tigerÓû§ÏµÄemp±íºÍdept±íÍê³ÉÏÂÁÐÁ·Ï°£¬±íµÄ½á¹¹ËµÃ÷ÈçÏÂ
¡¡¡¡empÔ±¹¤±í(empnoÔ±¹¤ºÅ/enameÔ±¹¤ÐÕÃû/job¹¤×÷/mgrÉϼ¶±àºÅ/hiredateÊܹÍÈÕÆÚ/salн½ð/commÓ¶½ð/deptno²¿ÃűàºÅ)
¡¡¡¡dept²¿Ãűí(deptno²¿ÃűàºÅ/dname²¿ÃÅÃû³Æ/locµØµã)
¡¡¡¡¹¤×Ê £½ н½ð £« Ó¶½ð
¡¡¡¡1£®ÁгöÖÁÉÙÓÐÒ»¸öÔ±¹¤µÄËùÓв¿ÃÅ
¡¡¡¡ ......