APEXtras

a development team dedicated to Oracle APEX

Print every Unicode character using PL/PDF

leave a comment »

CREATE OR REPLACE PROCEDURE EveryUnicodeChar IS
    l_char1 VARCHAR2(1);
    l_char2 VARCHAR2(1);
    l_char3 VARCHAR2(1);
    l_char4 VARCHAR2(1);
    l_counter NUMBER;
    l_newline INTEGER;
    FUNCTION HexChar(p_int IN INTEGER) RETURN VARCHAR2 IS
      l_char VARCHAR2(1);
    BEGIN
      IF p_int <= 9 THEN
        l_char := TO_CHAR(p_int);
      ELSE
        l_char := CHR(87 + p_int);
      END IF;
      RETURN l_char;
    END;
  BEGIN
    l_counter := 0;
    FOR I IN 0..15
    LOOP
      l_char1 := HexChar(I);
      FOR J IN 0..15
      LOOP
        l_char2 := HexChar(J);
        FOR K IN 0..15
        LOOP
          l_char3 := HexChar(K);
          FOR L IN 0..15
          LOOP
            l_char4 := HexChar(L);
            l_counter := l_counter + 1;
            IF (l_counter >= 20) THEN
              l_counter := 0;
              l_newline := 1;
            ELSE
              l_newline := 0;
            END IF;
            plpdf.PrintCell(5,5,UNISTR(‘\’ || l_char1 || l_char2 || l_char3 || l_char4),0,l_newline,’L’);
          END LOOP;
        END LOOP;
      END LOOP;
    END LOOP;
  END;
/

Written by Roger

28 April, 2009 at 12:17 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: