Oracle ×Ö·û´®³¤¶Èº¯Êý
LENGTH calculates length using characters as defined by the input character set.
LENGTHB uses bytes instead of characters.
VSIZE returns the number of bytes in the internal representation of expr.
LENGTHC uses Unicode complete characters.
LENGTH2 uses UCS2 codepoints.
LENGTH4 uses UCS4 codepoints
select length('adfadºÏÀí') "bytesLengthIs" from dual --7
select lengthb('adfad') "bytesLengthIs" from dual --5
select lengthb('adfadºÏÀí') "bytesLengthIs" from dual --11
select vsize('adfadºÏÀí') "bytesLengthIs" from dual --11
select lengthc('adfadºÏÀí')"bytesLengthIs" from dual --7
Òò´Ë£¬ÔÚutf-8µÄ×Ö·û¼¯ÏÂ
lengthb=vsize
lengthc=length
utf-8µÄÖÐÎÄ×Ö·ûÕ¼ÓÃ3¸ö×Ö½Ú,gbkµÄÖÐÎÄ×Ö·ûÕ¼ÓÃ2¸ö×Ö½Ú,iso-8859-1µÄÖÐÎÄ×Ö·û±»Ê¶±ðΪռÓÃ2¸ö×Ö½Ú,iso²»Ö§³ÖÖÐÎÄ×Ö·ûµÄ±àÂë,Ó¦¸ÃÊǶ¼µ±³Éij¸öÀ¶¡×ÖĸÁË.OracleûÓйØϵ£¬oracleÖ»ÊǸºÔð´æ´¢Êý¾Ý.
¿ÉÒÔÏÈÓà select * from v$nls_parameters ¿´¿´oracleµÄ×Ö·û¼¯
Ïà¹ØÎĵµ£º
oracle Set ÃüÁî½éÉÜ
http://luoke920.javaeye.com/blog/323743
1). ÉèÖõ±Ç°sessionÊÇ·ñ¶ÔÐ޸ĵÄÊý¾Ý½øÐÐ×Ô¶¯Ìá½»
SQL>SET AUTO[COMMIT] {ON|OFF|IMM[EDIATE]| n}
2)£®ÔÚÓÃstartÃüÁîÖ´ÐÐÒ»¸ösql½Å±¾Ê±£¬ÊÇ·ñÏÔʾ½Å±¾ÖÐÕýÔÚÖ´ÐеÄSQLÓï¾ä
SQL> SET ECHO {ON|OFF}
3).ÊÇ·ñÏÔʾµ±Ç°sqlÓï¾ä²éѯ»òÐ޸ĵÄÐÐÊý ......
Êý¾ÝÀàÐÍʹÓÃ
1.ÉùÃ÷£º
a.¸ñʽ£ºVariable_name [constant] databyte [not null] [:=default expression]
b.±äÁ¿Óë³£Á¿ÉùÃ÷»ù±¾Ò»Ö£¬Ê¹ÓÃconstantÉùÃ÷µÄΪ³£Á¿£¬²»Ê¹ÓÃΪ±äÁ¿£¬²¢ÇÒ¸³ÖµÖ»ÄÜÔÚDECLAREÇøÓò¸³Öµ£»
c.ʹÓÃ%TYPEºÍ%ROWTYPEÉùÃ÷¿ÉÒÔʹ±äÁ¿µÄÀàÐÍÓë±íÖÐ×Ö¶ÎÀàÐÍ»òÕû¸ö¼Ç¼ÀàÐͱ ......
½ñÌì×öͳ¼ÆµÄʱºò·¢ÏÖÒ»¸öÊý¾Ý±íÃæÉÏ¿´À´ÊÇ‘920 ’µ«È¥¿Õ¸ñÎÞÂÒÈçºÎ¶¼È¥²»µô£¬×îºó·¢ÏÖÊDz»¿É¼û×Ö·û¡£¡£¡£
ÓÚÊÇÔÚÍøÉÏËѵ½Ò»ÆªÎÄÕ£¬ÈçºÎÀ´ÅжÏÕâ¸ö²»¿É¼û×Ö·ûµÄÎÊÌâ~
°´ÏÂÃæµÄ·½·¨Åжϳö²»¿É¼û×Ö·ûµÄascIIÂëÊÇ10£¬ÓÚÊÇÓÃrtrim('Ô×Ö·û','chr(10)')À´È¥µôÕâ¸ö²»¿É¼û×Ö·û¡£
½ñÌìÓöµ½Ò»Ôò°¸Àý£¬ÎÊÌâÊÇÊý¾Ý¿âÖп ......
Íⲿ±íÊÇÖ¸²»ÔÚÊý¾Ý¿âÖÐµÄ±í£¬Èç²Ù×÷ϵͳÉϵÄÒ»¸ö°´Ò»¶¨¸ñʽ·Ö¸îµÄÎı¾Îļþ»òÕßÆäËûÀàÐÍµÄ±í¡£Õâ¸öÍⲿ±í¶ÔÓÚOracleÊý¾Ý¿âÀ´Ëµ£¬¾ÍºÃÏñÊÇÒ»ÕÅÊÓͼ£¬ÔÚÊý¾Ý¿âÖпÉÒÔÏñÊÔͼһÑù½øÐвéѯµÈ²Ù×÷¡£Õâ¸öÊÔͼÔÊÐíÓû§ÔÚÍⲿÊý¾ÝÉÏÔËÐÐÈκεÄSQLÓï¾ä£¬¶ø²»ÐèÒªÏȽ«Íⲿ±íÖеÄÊý¾Ý×°ÔؽøÊý¾Ý¿âÖС£²»¹ýÐèҪעÒâÊÇ£¬ÍⲿÊý¾Ý±í¶¼ÊÇÖ»¶ ......
¶ÔÓÚ Oracle µÄ rownum ÎÊÌ⣬ºÜ¶à×ÊÁ϶¼Ëµ²»Ö§³Ö>,>=,=,between...and£¬Ö»ÄÜÓÃÒÔÉÏ·ûºÅ(<¡¢<=¡¢!=)£¬²¢·Ç˵ÓÃ>,>=,=,between..and ʱ»áÌáʾSQLÓï·¨´íÎ󣬶øÊǾ³£ÊDz鲻³öÒ»Ìõ¼Ç¼À´£¬»¹»á³öÏÖËƺõÊÇĪÃûÆäÃîµÄ½á¹ûÀ´£¬ÆäʵÄúÖ»ÒªÀí½âºÃÁËÕâ¸ö rownum αÁеÄÒâÒå¾Í²»Ó¦¸Ã¸Ðµ½¾ªÆ棬ͬÑùÊÇαÁУ¬r ......