Code Listing 2: Using byte semantics
SQL> DECLARE
2 --Allow for three UTF-8 characters,
3 --which can each be three-bytes in size
4 x CHAR(9 BYTE);
5 BEGIN
6 --x can hold nine single-byte UTF-8 characters
7 x := 'aaaaaaaaa';
8 DBMS_OUTPUT.PUT_LINE(LENGTH(x));
9
10 --However, x can hold only four two-byte UTF-8 characters
11 x := 'ãããã';
12 DBMS_OUTPUT.PUT_LINE(LENGTH(x));
13 END;
14 /
9
5
|