DECLARE
v_text CLOB;
BEGIN
HTP.p ('<span id="TEST_ID">');
FOR i
IN (
select to_char(XML) "Information"
FROM EMPLOYEES where EMPLOYEEID=1243 )
LOOP
v_text := i."Information";
HTP.p ('<pre>' || replace(v_text,'&','&') || '</pre>');
END LOOP;
HTP.p ('</span>');
END;
2. Put the like HTML link code above the code.
HTP.p ('<a download="Information.txt" id="downloadlink" ><b>Download</b><br><br><br<br></a> ');
3. Finally copy-pest the below JavaScript into page properties> Function and Global Variable Declaration Option. Make sure TEST_ID and downloadlink these two id is in the proper place.
(function () {
var textFile = null,
makeTextFile = function (text) {
var data = new Blob([text], {type: 'text/plain'});
// If we are replacing a previously generated file we need to
// manually revoke the object URL to avoid memory leaks.
if (textFile !== null) {
window.URL.revokeObjectURL(textFile);
}
textFile = window.URL.createObjectURL(data);
return textFile;
};
var create = document.getElementById('create'),
textbox = document.getElementById('TEST_ID');
var link = document.getElementById('downloadlink');
link.href = makeTextFile(textbox.innerHTML.replace("&", "&").trim());
link.style.display = 'block';
})();
No comments:
Post a Comment