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