Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8220007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:22:18+00:00 2026-06-07T13:22:18+00:00

My aim is to retrieve CLOB data from the database into a textarea in

  • 0

My aim is to retrieve CLOB data from the database into a textarea in an Oracle Apex application and then to be able to save it into the database from the textarea itself on pressing a ‘Save’ button. I also have some other fields on this page (as textfields) which are non CLOB fields and they need to be saved in the database as well on clicking the button.

For this, I’m using the following code under “HTML Header and Body Attribute” of the page. This is used to retrieve/save CLOB into the textarea/database. Note that a simple PLSQL code inside the Apex item will suffice to do what I’m doing here but only if CLOB data is less than 32k bytes. I am using this function due to the 32k limit in plsql in apex (and 4k limit when sql is used).

function clob_set(){  
        var clob_ob = new apex.ajax.clob(  
            function(){  
                var rs = p.readyState  
                if(rs == 1||rs == 2||rs == 3){  
                    $x_Show('AjaxLoading');  
                }else if(rs == 4){  
                    $s('P5075_RESPONSETEXT',p.responseText);  
                    $x_Hide('AjaxLoading');  
                }else{return false;}  
            }  
        );  

        if(!$v_IsEmpty('P5075_STYLESHEET')){clob_ob._set($v('P5075_STYLESHEET'))};  
    }  

    function clob_get(){  
        var clob_ob = new apex.ajax.clob(  
            function(){  
                var rs = p.readyState  
                if(rs == 1||rs == 2||rs == 3){  
                    $x_Show('AjaxLoading');  
                }else if(rs == 4){  
                    $s('P5075_STYLESHEET',p.responseText);  
                    $x_Hide('AjaxLoading');  
                }else{return false;}  
            }  
        );  
        clob_ob._get();  
    }

I am calling one of the functions under “Page HTML Body Attribute” as onload = “javascript:clob_get();”

I have a PLSQL after header process for this.

declare
l_clob clob:= empty_clob();

begin

if apex_collection.collection_exists(p_collection_name=>'CLOB_CONTENT') then
apex_collection.delete_collection(p_collection_name=>'CLOB_CONTENT');
end if;

apex_collection.create_or_truncate_collection(p_collection_name=>'CLOB_CONTENT');
dbms_lob.createtemporary( l_clob, false, dbms_lob.SESSION );

SELECT xslt
INTO l_clob
FROM schematransform
WHERE namn = 'f';

apex_collection.add_member(p_collection_name => 'CLOB_CONTENT',p_clob001 => l_clob);
end;

This is working just fine. Now, I have a plsql process which saves the details entered in the CLOB and non-CLOB fields into the database. But as soon as the page submits, I get a “HTTP Bad Request”.

Can anyone please explain why is this happening and how can I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:22:21+00:00Added an answer on June 7, 2026 at 1:22 pm

    This is the code for apex.ajax.clob, taken from apex_4_1.js:

    /**
     * @namespace = apex.ajax
     */
    apex.ajax = {
        /*clob*/
        clob : function (pReturn){
            var that = this;
            this.ajax = new htmldb_Get(null,$x('pFlowId').value,'APXWGT',0);
            this.ajax.addParam('p_widget_name','apex_utility');
            this.ajax.addParam('x04','CLOB_CONTENT');
            this._get = _get;
            this._set = _set;
            this._return = !!pReturn?pReturn:_return;
            return;
            function _get(pValue){
                that.ajax.addParam('x05','GET');
                that.ajax.GetAsync(that._return);
            }
            function _set(pValue){
                that.ajax.addParam('x05','SET');
                that.ajax.AddArrayClob(pValue,1);
                that.ajax.GetAsync(that._return);
            }
            function _return(){
            if(p.readyState == 1){
                }else if(p.readyState == 2){
                }else if(p.readyState == 3){
                }else if(p.readyState == 4){
                  return p;
                }else{return false;}
            }
        },
    

    So, clob setting and getting is truly asynchronuous. The code you posted provides a handling function that is called when the request is finished (done in htmldb_get). I think it’s an ugly workaround but ok. We need to manipulate this function code for our submit to work. Since the set is async, we can’t be sure that the page will not be submitted before the set has occured. To prevent this, amend your clob_set code as such:

    function clob_set(pSubmit){
       var clob_ob = new apex.ajax.clob(
          function(){
             var rs = p.readyState
             if(rs == 1||rs == 2||rs == 3){
                $x_Show('AjaxLoading');
             }else if(rs == 4){
                 //here the clob has actually been saved, and
                 // the ajax call finished
                $s('P5075_RESPONSETEXT',p.responseText);
                $x_Hide('AjaxLoading');
    
                //pSubmit is a new param
                //use it to check if set has been called for
                //a page submit or not
                if(pSubmit){
                   //disable the clob field: it should not be
                   //substituted to the session state!!
                   $('#P5075_STYLESHEET').prop("disabled", true);
                   //actually submit the page. This will submit
                   //all fields to session except the disabled ones
                   apex.submit('SUBMIT');
                };
             }else{
                return false;
             };
          });
    
       if(!$v_IsEmpty('P5075_STYLESHEET')){
          clob_ob._set($v('P5075_STYLESHEET'));
       };
    };
    

    Alter your submit button, and have it’s action be defined by a dynamic action. You need to do this to prevent the substitution of your clob-fields to the session through the default process. Create a dynamic action which executes javascript, call clob_set with pSubmit set:

    clob_set(true);
    

    Do have a look at the apex.submit api description. Also understand how a button works: it submits the page and will set the request to the name of that button (or another request value if explicitly defined).

    For example, a button could be named ‘APPLY_CHANGES’ and have a label ‘Change’. This is important if you use for example the built-in row processing. The request value will determine which SQL-action will be invoked, and you can view the possible values in the details of the process, next to the checkboxes for insert/update/delete.

    Here, a most helpful beautiful flowchart:

    clob_set flowchart

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My aim is to retrieve some data from a global array which is defined
My aim is to retrieve some data from a global array which is defined
my aim is to pull data from mysql and print it in html table.
My aim is to restore an Oracle database back to it's previous state after
I have a Python application. It has an SQLite database, full of data about
Aim to Acheive : I want to execute my application from msbuild as it
Aim I am looking to scrape 20/20 cricket scorecard data from the Cricinfo website
I am new to this database programming.i retrieved single column data from the database.but
I am trying to retrieve some data from an API using CURL request. Is
Aim : To convert a integer value first to hexstring and then to byte[].

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.