Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving and retrieving CLOB data greater than 32K in Oracle Apex
    primarykey
    data
    text
    <p>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.</p> <p>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).</p> <pre><code>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(); } </code></pre> <p>I am calling one of the functions under "Page HTML Body Attribute" as <strong>onload = "javascript:clob_get();"</strong></p> <p>I have a PLSQL after header process for this.</p> <pre><code>declare l_clob clob:= empty_clob(); begin if apex_collection.collection_exists(p_collection_name=&gt;'CLOB_CONTENT') then apex_collection.delete_collection(p_collection_name=&gt;'CLOB_CONTENT'); end if; apex_collection.create_or_truncate_collection(p_collection_name=&gt;'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 =&gt; 'CLOB_CONTENT',p_clob001 =&gt; l_clob); end; </code></pre> <p>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".</p> <p>Can anyone please explain why is this happening and how can I solve this? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COWhat apex version are you on? 4.0? 4.1? Lower? What is the size of the clob you are testing with? Have you tried with a <32k clob? Or a <4k? Take a read through https://forums.oracle.com/forums/thread.jspa?threadID=723735 and http://www.advnettech.net/blog/?p=7 , those seem to handle this kind of problem, and seem to indicate a problem with apex.ajax.clob and >32k.
      singulars
    2. COI'm using Apex 4.1. I have tested with CLOB size as small as 90 bytes and as large as 50k bytes. I am having the same issue. I'm getting the CLOB in the textarea correctly. It's just that when I call the javascript function when the page loads and then submit the page, I get this error. The process that is saving the textfields is of type "PLSQL Anonymous block" and the process point is "On Load - After Header". This process gets submitted when I click on a Submit button named "Save".The problem I see is some conflict between 'page onload calling javascript' and 'page submit' after that.
      singulars
    3. COI'm not sure if i understand correctly: Page loads, on-load fires, you get clob values. You make edits. You click a button which submits the page, and you expect the fields with clob-values to be saved to the collection? Correct?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload