µ¥Öµº¯ÊýÔÚ²éѯÖзµ»Øµ¥¸öÖµ£¬¿É±»Ó¦Óõ½select£¬where×Ӿ䣬start withÒÔ¼°connect by ×Ó¾äºÍhaving×Ӿ䡣
(Ò»).ÊýÖµÐͺ¯Êý(Number Functions)
ÊýÖµÐͺ¯ÊýÊäÈëÊý×ÖÐͲÎÊý²¢·µ»ØÊýÖµÐ͵ÄÖµ¡£¶àÊý¸ÃÀຯÊýµÄ·µ»ØÖµÖ§³Ö38λСÊýµã£¬ÖîÈ磺COS, COSH, EXP, LN, LOG,
SIN, SINH, SQRT, TAN, and TANH Ö§³Ö36λСÊýµã¡£ACOS, ASIN, ATAN, and
ATAN2Ö§³Ö30λСÊýµã¡£
1¡¢MOD(n1,n2) ·µ»Øn1³ýn2µÄÓàÊý£¬Èç¹ûn2=0Ôò·µ»Øn1µÄÖµ¡£
ÀýÈ磺SELECT MOD(24,5) from DUAL;
2¡¢ROUND(n1[,n2])
·µ»ØËÄÉáÎåÈëСÊýµãÓÒ±ßn2λºón1µÄÖµ£¬n2ȱʡֵΪ0£¬Èç¹ûn2Ϊ¸ºÊý¾ÍÉáÈ뵽СÊýµã×ó±ßÏàÓ¦µÄλÉÏ(ËäÈ»oracle
documentsÉÏÌáµ½n2µÄÖµ±ØÐëΪÕûÊý£¬ÊÂʵÉÏÖ´ÐÐʱ´Ë´¦µÄÅжϲ¢²»ÑϽ÷£¬¼´Ê¹n2Ϊ·ÇÕûÊý£¬ËüÒ²»á×Ô¶¯½«n2È¡Õûºó×ö´¦Àí£¬µ«ÊÇÎÒÎĵµÖÐÆäËüÌáµ½
±ØÐëΪÕûµÄµØ·½ÐèÒªÌرð×¢Ò⣬Èç¹û²»ÎªÕûÖ´ÐÐʱ»á±¨´íµÄ)¡£
ÀýÈ磺SELECT ROUND(23.56),ROUND(23.56,1),ROUND(23.56,-1) from DUAL;
3¡¢TRUNC(n1[,n2] ·µ»Ø½Øβµ½n2λСÊýµÄn1µÄÖµ£¬n2ȱʡÉèÖÃΪ0£¬µ±n2ΪȱʡÉèÖÃʱ»á½«n1½ØβΪÕûÊý£¬Èç¹ûn2Ϊ¸ºÖµ£¬¾Í½ØβÔÚСÊýµã×ó±ßÏàÓ¦µÄλÉÏ¡£
ÀýÈ磺SELECT TRUNC(23.56),TRUNC(23.56,1),TRUNC(23.56,-1) from DUAL;
(¶þ).×Ö·ûÐͺ¯Êý·µ»Ø×Ö·ûÖµ(Character Functions Returning Character Values)
¡¡¡¡¸ÃÀຯÊý·µ»ØÓëÊäÈëÀàÐÍÏàͬµÄÀàÐÍ¡£
? ·µ»ØµÄCHARÀàÐÍÖµ³¤¶È²»³¬¹ý2000×Ö½Ú£»
? ·µ»ØµÄVCHAR2ÀàÐÍÖµ³¤¶È²»³¬¹ý4000×Ö½Ú£»
Èç¹ûÉÏÊöÓ¦·µ»ØµÄ×Ö·û³¤¶È³¬³ö£¬oracle²¢²»»á±¨´í¶øÊÇÖ±½Ó½Ø¶ÏÖÁ×î´ó¿ÉÖ§³Ö³¤¶È·µ»Ø¡£
? ·µ»ØµÄCLOBÀàÐÍÖµ³¤¶È²»³¬¹ý4G£»
¶ÔÓÚCLOBÀàÐ͵ĺ¯Êý£¬Èç¹û·µ»ØÖµ³¤¶È³¬³ö£¬oracle²»»á·µ»ØÈκδíÎó¶øÊÇÖ±½ÓÅ׳ö´íÎó¡£
1¡¢LOWER(c) ½«Ö¸¶¨×Ö·û´®ÄÚ×Ö·û±äΪСд£¬Ö§³ÖCHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB,NCLOBÀàÐÍ
ÀýÈ磺SELECT LOWER('WhaT is tHis') from DUAL;
2¡¢UPPER(c) ½«Ö¸¶¨×Ö·û´®ÄÚ×Ö·û±äΪ´óд£¬Ö§³ÖCHAR,VARCHAR2,NCHAR,NVARCHAR2,CLOB,NCLOBÀàÐÍ
ÀýÈ磺SELECT UPPER('WhaT is tHis') from DUAL;
3¡¢LPAD(c1,n[,c2]) ·µ»ØÖ¸¶¨³¤¶È=nµÄ×Ö·û´®£¬ÐèҪעÒâµÄÓм¸µã£º
? Èç¹ûn<c1.lengthÔò´ÓÓÒµ½×ó½ØÈ¡Ö¸¶¨³¤¶È·µ»Ø£»
? Èç¹ûn>c1.length and c2 is null£¬ÒÔ¿Õ¸ñ´Ó×óÏòÓÒ²¹³ä×Ö·û³¤¶ÈÖÁn²¢·µ»Ø£»
? Èç¹ûn>c1.length and c2 is not null£¬ÒÔ
oracle´Ó9i¿ªÊ¼Ö§³ÖÒ»ÖÖеÄÊý¾ÝÀàÐÍ---- xmltype£¬ÓÃÓÚ´æ´¢ºÍ¹ÜÀíxmlÊý¾Ý£¬²¢ÌṩÁ˺ܶàµÄfunctions£¬ÓÃÀ´Ö±½Ó¶ÁÈ¡xmlÎĵµºÍ¹ÜÀí½Úµã¡£ÏÂÃ潫½éÉÜxmltypeµÄһЩ»ù±¾Ê¹Óá£
1.½¨Á¢º¬ÓÐxmltypeÊý¾ÝÀàÐ͵ıí
create table abc (id number,xmldoc sys.xmltype);
ÉùÃ÷xmltypeÐÍ×Ö¶ÎÓÃ:sys.xmltype
2.Ïò´øÓÐxmltypeÀàÐ͵ıí ......