Print CLOB Column content in Oracle Apex Region

We all facing to print clob content in oracle apex report region. In this post we will see how to print clob content in “PL/SQL Dynamic Content Region”.

Step 1: Create PL/SQL Dynamic Content Region.

Step2: Make PL/SQL script to print in a region, for example see below script.

DECLARE
    CURSOR crec IS
    SELECT
        clob_volumn
    FROM
        xx_apex_thamarai_t
        where id = :id;
    rrec      crec%rowtype;
    
    l_amt   INTEGER := 4000;
    l_pos   INTEGER := 1;
    l_buf   VARCHAR2(32000);
BEGIN
    OPEN crec;
    FETCH crec INTO rrec;
    CLOSE crec;
    
    LOOP 
        BEGIN
            dbms_lob.read(rrec.clob_volumn, l_amt, l_pos, l_buf); /* Splitting the CLOB Content with buffer size */
            l_pos := l_pos + l_amt;
            l_amt := 4000;
            htp.p(l_buf); /* Print Content */
        EXCEPTION
            WHEN no_data_found THEN
                EXIT;
        END;
    END LOOP;
END;

Step 3: Use HTP.P to print HTML content. Refer below link Click to See Reference

That’s it you can print html (or) clob content in PL/SQL Dynamic Content Region.

Happy Apexing!

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s