apex upload store as clob

i'll provide a function which i have used in my latest project.This function getting uploaded blob content and converting this to clob.

you know apex file browse item storing uploded content into wwv_flow_files as blob after that developer responsible for storing this content in application spesific tables via fetching from wwv_flow_files

if you need to store your uploded content from apex as clob
you can use this function



FUNCTION uploaded_clob(p_name IN VARCHAR2) RETURN CLOB IS

l_clob_content CLOB;
l_blob_content BLOB;
l_w PLS_INTEGER;
l_d_offset PLS_INTEGER := 1;
l_s_offset PLS_INTEGER := 1;
l_lc PLS_INTEGER := dbms_lob.default_lang_ctx;

BEGIN

dbms_lob.createtemporary(lob_loc => l_clob_content, cache => TRUE);

SELECT *
INTO l_blob_content
FROM (SELECT t.blob_content
FROM wwv_flow_files t
WHERE t.NAME = p_name
ORDER BY created_by DESC)
WHERE rownum < 2;

dbms_lob.converttoclob(dest_lob => l_clob_content,
src_blob => l_blob_content,
amount => dbms_lob.lobmaxsize,
dest_offset => l_d_offset,
src_offset => l_s_offset,
blob_csid => dbms_lob.default_csid,
lang_context => l_lc,
warning => l_w);

RETURN l_clob_content;

END uploaded_clob;

Comments

Popular posts from this blog

Pyppeteer fix for BrowserError: Browser closed unexpectedly

overlay filesystem and containers

How to add pagination to django comments for your model