oracleµ¥Ðк¯Êý
µ¥Ðк¯Êý:
º¯ÊýÀà±ð:
µ¥ÐÐ:·µ»Øµ¥¸ö½á¹û:substr,length
¶àÐÐ:·µ»Ø¶à¸ö½á¹û,any,all
µ¥ÐеķÖÀà:
×Ö·ûÀ࣬ÈÕÆÚÀ࣬Êý×ÖÀ࣬ת»»À࣬ͨÓÃÀà
1.×Ö·ûÀà
ת»»´óСд:
lower:ת»»ÎªÐ¡Ð´
Select ENAME,LOWER(ENAME) from EMP
upper:ת»»Îª´óд
Select upper('abcd') from DUAL
initcap :Ê××Öĸ´óд
Select INITCAP(ENAME) from EMP
2.×Ö·û´¦ÀíÀà
concat:Á¬½ÓÁ½¸ö²»Í¬µÄÁÐ,CONCAtÖ»ÄܽÓÊÜÁ½¸ö²ÎÊý
Select CONCAT(EMPNO,ENAME) from EMP
Select CONCAT('A','B') from dual
substr:½ØÈ¡×Ó´®
ϱê´Ó1¿ªÊ¼
Select SUBSTR(ENAME,2) from EMP--´ÓµÚ2¸öλÖýص½Ä©Î²
Select SUBSTR(ENAME,2,3) from EMP--´ÓµÚ2¸öλÖýØÈ¡3¸ö
length:ÌáÈ¡³¤¶È
Select ENAME,length(ename) from emp
INSTR:Ï൱ÓÚStringÀàÖеÄindexOf,ÇóË÷Òý
Select ENAME,instr(ename,'A') from emp
LPADºÍRPADµÄÓ÷¨
±íʾ²¹³äµÄº¬Òå
Select LPAD(SAL,10,'*') from EMP
Select RPAD(SAL,10,'*') from EMP
½«salÏÔʾΪ10λ,²»×ãµÄλÖò¹ÉÏ×Ö·û*
trimÁ½±ßÂË¿Õ
Select Trim(' A B C ') from DUal
ʹÓÃLTrimeºÍRTrim¹ýÂËÒ»±ßµÄ¿Õ¸ñ
Select LTrim(' A B C ') from DUAL
REPLACE:Ìæ»»
Select ename ,Replace(ename,'A','B') from EMP
3.Êý×Öת»»Àà:
ROUND:ËÄÉáÎåÈë
TRUNC:½ØÈ¡
MOD:È¡Óà
Select ROUND(16.336666663,3) from DUAL
Select TRUNC(16.33666666,3) from DUAL
Select Mod(8,3) from DUAL
4.ÈÕÆÚÀຯÊý
sysdate:ÄêÔÂÈÕʱ·ÖÃë
ÈÕÆÚ+-1,¶¼´ú±íÒ»ÌìµÄʱ¼ä,±ÈÈç:
Select TRUNC(Sysdate-365) from DUAL
Select Sysdate-1/24/60 from DUAL
5.ÈÕÆÚÔËË㺯Êý
MONTHS_BETWEEN:±íʾÁ½¸öÈÕÆÚµÄÔ·ÝÖ®²î
Select EMPNO,HIREDATE,MONTHS_BETWEEN(Sysdate,HIREDATE)/12 from EMP
ADD_MONTHS:±íʾ¸øÖ¸¶¨µÄÈÕÆÚ¼ÓÒ»¸öÔÂÊý
Select HIREDATE,ADD_MONTHS(HIREDATE,3) from EMP
NEXT_DAY:±íʾÒÔµ±Ç°Ê±¼äΪ»ù×¼,ÏÂÒ»¸ö"Ä¿±êÈÕ"µÄÈÕÆÚ
Select NEXT_DAY(Sysdate,'ÐÇÆÚ¶þ') from DUAL
LAST_DAY:¼ÆË㵱ǰÈÕÆÚµÄ×îºóÒ»Ìì
Select HIREDATE,LAST_DAY(HIREDATE)-HIREDATE from EMP
ROUND:¶ÔÈÕÆÚ½øÐÐËÄÉáÎåÈë
Select ROUND(Sysdate,'YEAR') from DUAL
TRUNC:±íʾ¶ÔÈÕÆÚ½øÐнØÈ¡
Select TRUNC(Sysdate) from DUAL
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔÀ´ÈÏΪexists±ÈinЧÂʸߵÄ˵·¨ÊDz»×¼È·µÄ¡£
Èç¹û²éѯµÄÁ½¸ö±í´óСÏ൱£¬ÄÇôÓÃinºÍexists²î±ð²»´ó¡£
in ÊÇ°ÑÍâ±íºÍÄÚ±í×÷hash
Á¬½Ó£¬¶øexistsÊǶÔÍâ±í×÷loopÑ»·£¬Ã¿´ÎloopÑ»·ÔÙ¶ÔÄÚ±í½øÐвéѯ¡£
Ò»Ö±ÒÔ ......
Oracle Êý¾ÝÀàÐͼ°´æ´¢·½Ê½
Ô¬¹â¶« Ô´´
¸ÅÊö
ͨ¹ýʵÀý£¬È«Ãæ¶øÉîÈëµÄ·ÖÎöoralceµÄ»ù±¾Êý¾ÝÀàÐͼ°ËüÃǵĴ洢·½Ê½¡£ÒÔORACLE 10GΪ»ù´¡£¬½éÉÜoralce 10gÒýÈëµÄеÄÊý¾ÝÀàÐÍ¡£ÈÃÄã¶ÔoracleÊý¾ÝÀàÐÍÓÐÒ»¸öȫеÄÈÏʶ¡£½ÒʾһЩ²»ÎªÈËÖªµÄÃØÃܺͱ»ºöÂÔµÄäµã¡£´ÓʵÓúÍÓÅ»¯µÄ½Ç¶È³ö·¢£¬ÌÖÂÛÿÖÖÊý¾ÝÀàÐ͵ÄÌص㡣´ÓÕ ......
×î½ü¹«Ë¾´òËãÔÚÏÂÒ»´ú¼Æ·ÑϵͳÀïÃæʹÓÃÄÚ´æÊý¾Ý¿âµÄ¼¼Êõ£¬ËùÒÔ×÷Ϊ¹«Ë¾µÄÉè¼ÆÈËÔ±Ö®Ò»µÄÎÒ£¬ÔÚoracleÍøÉÏÏÂÁ˸öTimesTen£¬°²×°ÔÚÎÒÃǵIJâÊÔ·þÎñÆ÷ÉÏÃæaix5£¬Õâƪ¶ÌÎÄÖ÷ÒªÊÇÎÒ²Ù×÷Êý¾Ý¿âµÄÒ»¸ö±Ê¼Ç£¬ÏÂһƪ´òËã·¢Ò»¸öc³ÌÐòµÄÀý×ÓºÍÎÒ²âÊԵĽá¹û£¬ºóÐø¿ÉÄÜ»¹»áʹÓÃTimesTen cache of oracleÕâ¸ö²úÆ·£¬Â½ÐøÒ²»á·¢Ò»ÏÂÕâ· ......
SQL> select dbms_metadata.get_ddl('PROCEDURE','PRO2','SCOTT') text from dual;
TEXT
----------------------------------------
CREATE OR REPLACE PROCEDURE "SCOTT"."P
RO2"
is
begin
dbms_output.put_line('wangpeng up');
end;
SQL> select dbms_metadata.get_ddl('PROCEDURE','PRO1','SCOTT') te ......