2013-07-08 16 views
5
select 

length('abcdefg') english, 
length('가나다라마바사') korean 

from dual 

Questo ritorna sotto.lunghezza mysql() per diverse lingue restituisce diverse dimensioni

english korean 
7  21 

C'è qualche funzione che restituisce il conteggio del carattere non i caratteri byte?

voglio dire che cosa ho bisogno è

english korean 
7  7 
+0

Dai un'occhiata a questa domanda: http://stackoverflow.com/questions/1734334/mysql-length-vs-char-length –

risposta

1

Vedi the manual:

Riporta la lunghezza della stringa str, misurata in byte. Un carattere multi-byte conta come più byte. Ciò significa che per una stringa contenente cinque caratteri a 2 byte, la lunghezza() restituisce 10, mentre i rendimenti CHAR_LENGTH() 5.

CHAR_LENGTH() farà quello che vuoi.

Problemi correlati