How To Show More Than 4000 Characters In Apex Application Report?

How To Show More Than 4000 Characters In Apex Application Report

Maybe you should think about it - who wants to read CLOB content on screen? That's just too much text. The best option would be to allow users to download CLOB content, if they want (and display the first 100 or 200 characters). If not, see if switching to PL / SQL Dynamic regiona l content type is helpful. It means you will actually "draw" the report yourself, read the CLOB content in the loop and create a region using htp.p calls. Sample code is available on Universal theme pages. In the unlikely event that it is not available, here are:

Example-1..............

DECLARE
    CURSOR c_tasks IS
        SELECT B_DATA, C_DATA
          FROM TEST_DATA
         WHERE ROWNUM < 5;
BEGIN
    sys.HTP.p ('');

    FOR a IN c_tasks
    LOOP
        sys.HTP.p (
               ''
            || apex_escape.html (a.task_name)
            || ' ('
            || apex_escape.html (a.assigned_to)
            || ')');
    END LOOP;

    sys.HTP.p ('');
END;

Example-2..............

SELECT DECODE (
           status,
           'active',    reason1
                     || reason2
                     || reason3
                     || SUBSTR (
                            other,
                            1,
                            4000 - LENGTH (reason1 || reason2 || reason3)),
           'inactive', reasonforchange)    reason
  FROM "TEST_DATA";

You Want The First 4000 Bytes, Pre-calculate The Maximum Length

WITH
    data
    AS
        (    SELECT 1 id, LEVEL rn, 'x' txt
               FROM DUAL
         CONNECT BY LEVEL <= 4000
         UNION ALL
             SELECT 2 id, LEVEL rn, 'y' txt
               FROM DUAL
         CONNECT BY LEVEL <= 4000),
    check_length
    AS
        (SELECT id,
                B_DATA,
                  SUM (LENGTHB (txt)) OVER (PARTITION BY id ORDER BY rn)
                + COUNT (*) OVER (PARTITION BY id ORDER BY rn)
                - 1    total_length,
                txt
           FROM TEST_DATA)
  SELECT id, LISTAGG (B_DATA, ',') WITHIN GROUP (ORDER BY rn) txt_list
    FROM TEST_DATA
   WHERE total_length <= 4000
GROUP BY id;

Column With More Than 4000 Characters...

CREATE TABLE TEST_DATA
(
    B_DATA    CLOB
);


INSERT INTO TEST_DATA
     VALUES (RPAD (TO_CLOB ('a_data'), 4001, 'a_daTa'));

My Solution, characters in apex application Which Should Not Be Used For Repeated Queries (But For Extracting And Uploading / Storing Data In The Varchar2 Column), Is:

CREATE OR REPLACE FUNCTION SUBSTR_BIG_DATA_MULTIBYTE_CLOB (P_DATA          IN CLOB,
                                                  P_START_INDEX   IN NUMBER)
    RETURN VARCHAR2
AS
    P_OUT      VARCHAR2 (4000 BYTE);
    P_LENGTH   NUMBER := 4000;
BEGIN
    FOR loop_counter IN 1 .. 400
    LOOP
        BEGIN
            P_OUT :=
                DBMS_LOB.SUBSTR (P_DATA,
                                 P_LENGTH - ((loop_counter - 1) * 10),
                                 P_START_INDEX);
            RETURN P_OUT;
        EXCEPTION
            WHEN OTHERS
            THEN
                IF    SQLCODE = -12801
                   OR SQLCODE = -6502
                   OR SQLCODE = -1401
                   OR SQLCODE = -1489
                THEN
                    NULL; 
                ELSE
                    RAISE;
                END IF;
        END;
    END LOOP;
END SUBSTR_BIG_DATA_MULTIBYTE_CLOB;

characters in apex application, Fetch Up To 5-Mb Of Data From A Large Oracle CLOB Column....

DECLARE
    subs            VARCHAR2 (32767);
    BIG_DATA_clob   CLOB;
BEGIN
    SELECT B_DATA INTO BIG_DATA_clob FROM TEST_DATA;

    subs := DBMS_LOB.SUBSTR (BIG_DATA_clob, 32767, 1);

    DBMS_OUTPUT.put_line ('Clob length: ' || DBMS_LOB.getlength (subs));
END;
/


DECLARE
    subs            CLOB;
    BIG_DATA_clob   CLOB;
BEGIN
    SELECT B_DATA INTO BIG_DATA_clob FROM TEST_DATA;

    subs := DBMS_LOB.SUBSTR (BIG_DATA_clob, 32768, 1);

    DBMS_OUTPUT.put_line ('Clob length: ' || DBMS_LOB.getlength (subs));
END;
/

characters in apex application, Create A Job And Call That Job Whenever You Need To Select A CLOB Column.

CREATE OR REPLACE FUNCTION CLOB_TO_CHAR (CLOB_COLUMN          IN CLOB,
                                         FOR_HOW_MANY_BYTES   IN NUMBER,
                                         FROM_WHICH_BYTE      IN NUMBER)
    RETURN VARCHAR2
IS
BEGIN
    RETURN SUBSTRB (
               DBMS_LOB.SUBSTR (CLOB_COLUMN,
                                FOR_HOW_MANY_BYTES,
                                FROM_WHICH_BYTE),
               1,
               FOR_HOW_MANY_BYTES);
END;
characters in apex application, Call The Function
SELECT TOCHARVALUE, CLOB_TO_CHAR (TOCHARVALUE, 1, 9999)
  FROM (SELECT BIG_DATA AS TOCHARVALUE FROM TEST_DATA);

How To Find And Replace Text In Oracle Apex Application?

PLPLE works in oracle to replace one unit of character with another. REPLACE allows you to remove any unwanted characters from the quote. When search_string is empty Oracle returns the original expression without any modifications to it.

SELECT ID,
         NAME,
         MAMLA_NO,
         REPLACE (MAMLA_NO, ' style="font-size:22px"', '')     MAMLA_NO,
         REG_NO
    FROM PART_16
   WHERE REG_NO IS NULL
ORDER BY id

🔗 Demo Application-
URL- Demo Application
Username - demo, Pass- demo

I hope everyone will like it. Please watch the full video,
Comment on any of your problems, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable. Visit my blog site, new technology related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
Please stay tuned by subscribing to the YouTube channel, and encourages new videos to be uploaded.
=================
Visit my site to get more collaborative posts about Oracle Apex and subscribe to my YouTube channel. Thanks.
Comment on any of your issues, I will try my best to solve the problem, In-Shah Allah. Everyone's cooperation is desirable.
Visit my blog site, new technology-related videos, you will get different types of tutorials of Oracle Apex, and hopefully, you can use them in your daily work.
==============================

🙍🏾‍ Md jABER HOSSEN
📲 Mobile- +8801760688286
📨 Email- jaberit786@gmail.com
🌐 FB- facebook.com/mdjaber.hossen1
Please Subscribe to My Channel

Many thanks for visiting the site.

Then Enjoy.........................

Post a Comment

Hlo Sir

Previous Post Next Post