Skip to content

Instantly share code, notes, and snippets.

@stefandobre
Last active February 18, 2021 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefandobre/4d45614bf080559ec2dbe09f671184f6 to your computer and use it in GitHub Desktop.
Save stefandobre/4d45614bf080559ec2dbe09f671184f6 to your computer and use it in GitHub Desktop.
declare
type module_t is table of varchar2(100) index by varchar2(100);
l_modules module_t := module_t();
l_module varchar2(100);
l_code clob;
begin
/* store the name and location of each library that is to be imported */
l_modules('qrcode') := 'https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.4.4/qrcode.min.js';
l_modules('validator') := 'https://cdnjs.cloudflare.com/ajax/libs/validator/13.5.2/validator.min.js';
l_modules('marked') := 'https://cdnjs.cloudflare.com/ajax/libs/marked/1.2.9/marked.min.js';
delete from javascript_modules;
l_module := l_modules.first;
/* loop through all records, GET each library and save it in the javascript_modules table */
while l_module is not null
loop
l_code := apex_web_service.make_rest_request
( p_url => l_modules(l_module)
, p_http_method => 'GET'
);
insert
into javascript_modules
values (l_module, l_code);
l_module := l_modules.next(l_module);
end loop;
commit;
end;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment