Oracle -- length (lengthb) and function (difference)

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

Have a look first few examples:

select length('Oracle') from dual

Result: 6


select lengthb('Oracle') from dual

Result: 6


select length('Oracle') from dual

Result: 3


select lengthb('Oracle') from dual

Result: 6


[Difference: ]

length()Returns the number of characters

lengthb()Returns the number of bytes


[Use: ]

a, You can query a field are English record

    SELECT * FROM TBL_NAME WHERE LENGTH(COL_A) = LENGTHB(COL_A)

b, You can query a field contains the Chinese Records

    SELECT * FROM TBL_NAME WHERE LENGTH(COL_A) <> LENGTHB(COL_A)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Martin at November 21, 2013 - 6:34 PM