Wednesday, November 25, 2026

Does DBMS_METADATA support MLE Modules ?

Question of the day: 
can DBMS_METADATA.GET_DDL return the DDL for creating a MLE Module?

The short answer is YES even though there is no mention in the official documentation for Oracle version 26ai.

Image courtesy of Google Gemini
 

Below the sample script I used to check if the JavaScript module I created using Visual Studio Code could be retrieved using DBMS_METADATA:

-- NOTICE: these settings might need adjustments for other use cases
set feedback off exec DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',true); exec DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM, 'EMIT_SCHEMA', false); set pagesize 0 set linesize 32767 set long 32767 set longchunksize 32767 select dbms_metadata.get_ddl('MLE_MODULE', m.module_name) as obj from user_mle_modules m where m.module_name = 'HTML2MD_MOD';

 CREATE OR REPLACE MLE MODULE "HTML2MD_MOD" 
LANGUAGE JAVASCRIPT AS
const VOID = new Set(['area','base','br','col','embed','hr','img','input','link','meta','source','track','wbr']);
const SKIP = new Set(['script','style','head','noscript','template','iframe','object','embed','svg','canvas','meta','link']);
const BLOCK = new Set(['p','div','section','article','header','footer','main','nav','aside','figure','figcaption','form','fieldset','dl','dt','dd','address','details','summary','center']);
const ENT = {amp:'&',lt:'<',gt:'>',quot:'"',apos:"'",nbsp:' ',copy:'\u00A9',reg:'\u00AE',trade:'\u2122',hellip:'\u2026',mdash:'\u2014',ndash:'\u2013',lsquo:'\u2018',rsquo:'\u2019',ldquo:'\u201C',rdquo:'\u201D',laquo:'\u00AB',raquo:'\u00BB',bull:'\u2022',middot:'\u00B7',euro:'\u20AC',agrave:'\u00E0',egrave:'\u00E8',eacute:'\u00E9',igrave:'\u00EC',ograve:'\u00F2',ugrave:'\u00F9'};

function decode(s) {
return s.replace(/&(#x[0-9a-f]+|#\d+|[a-z][a-z0-9]*);/gi, (m, e) => {
if (e[0] === '#') {
const cp = (e[1] === 'x' || e[1] === 'X') ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
try { return String.fromCodePoint(cp); } catch (_) { return m; }
}
const v = ENT[e] !== undefined ? ENT[e] : ENT[e.toLowerCase()];
return v !== undefined ? v : m;
});
}
... etc, etc.

 

The source of MLE Modules can also be retrieved using views USER_SOURCE / ALL_SOURCE / DBA_SOURCE. 

set wrap off
set pagesize 0 set linesize 32767 set long 32767 set longchunksize 32767
column text format A400
select text from user_source where name = 'HTML2MD_MOD' order by line;

const VOID = new Set(['area','base','br','col','embed','hr','img','input','link','meta','source','track','wbr']);
const SKIP = new Set(['script','style','head','noscript','template','iframe','object','embed','svg','canvas','meta','link']);
const BLOCK = new Set(['p','div','section','article','header','footer','main','nav','aside','figure','figcaption','form','fieldset','dl','dt','dd','address','details','summary','center']);
const ENT = {amp:'&',lt:'<',gt:'>',quot:'"',apos:"'",nbsp:' ',copy:'\u00A9',reg:'\u00AE',trade:'\u2122',hellip:'\u2026',mdash:'\u2014',ndash:'\u2013',lsquo:'\u2018',rsquo:'\u2019',ldquo:'\u201C',rdquo:'\u201D',laquo:'\u00AB',raquo:'\u00BB',bull:'\u2022',middot:'\u00B7',euro:'\u20AC',agrave:'\u00E0',egrave:'\u00E8',eacute:'\u00E9',igrave:'\u00EC',ograve:'\u00F2',ugrave:'\u00F9'};

function decode(s) {
return s.replace(/&(#x[0-9a-f]+|#\d+|[a-z][a-z0-9]*);/gi, (m, e) => {
if (e[0] === '#') {
const cp = (e[1] === 'x' || e[1] === 'X') ? parseInt(e.slice(2), 16) : parseInt(e.slice(1), 10);
try { return String.fromCodePoint(cp); } catch (_) { return m; }
}
const v = ENT[e] !== undefined ? ENT[e] : ENT[e.toLowerCase()];
return v !== undefined ? v : m;
});
}
... etc, etc.

 

Tuesday, November 24, 2026

Oracle APEX Supporting Objects Data Package Feature

While continuing the development of my OllAPEX application, I realized that initializing certain tables containing prompts, descriptions, JSON schemas, was just as important as installing the database objects themselves.

Image courtesy of Google Gemini

These pieces of information are crucial when talking to the LLMs, they can make a huge difference in the results one gets and can be subject to refinements over time, as I could see first hand when I implemented the "tool calls" functionality in my agentic loops: a sentence, a word can determine if a tool call is made or not.

One nifty feature, albeit not covering 100% of use cases, is APEX's Data Package located in the Supporting Objects section of the Application Builder.

The Data Package functionality allows you to take one or more tables, pack their contents into JSON documents, zip them, allowing an APEX API to read them at installation time, with the option to delete the "package" after a successful import.

Each table content is "packed" into a separate ZIP file containing two JSON files:
one file contains a table layout description while the other contains the actual data, see below for an example:

the "profile"
{ "file-type" : 4, "single-row" : false, "file-encoding" : "AL32UTF8", "row-selector" : "items", "headings-in-first-row" : false, "csv-enclosed" : "\"", "force-trim-whitespace" : true, "columns" : [ { "name" : "ID", "data-type" : 2, "decimal-char" : ".", "data-type-len" : 22, "selector" : "id", "is-json" : false }, { "name" : "FILE_EXT", "data-type" : 1, "data-type-len" : 20, "selector" : "file_ext", "is-json" : false }, { "name" : "MIME_TYPE", "data-type" : 1, "data-type-len" : 120, "selector" : "mime_type", "is-json" : false }, { "name" : "MARKDOWN_LANG", "data-type" : 1, "data-type-len" : 30, "selector" : "markdown_lang", "is-json" : false }, { "name" : "PRIORITY", "data-type" : 2, "decimal-char" : ".", "data-type-len" : 22, "selector" : "priority", "is-json" : false }, { "name" : "IS_ACTIVE", "data-type" : 1, "data-type-len" : 1, "selector" : "is_active", "is-json" : false }, { "name" : "CREATED_AT", "data-type" : 3, "data-type-len" : 7, "selector" : "created_at", "format-mask" : "YYYY-MM-DD\"T\"HH24:MI:SS", "is-json" : false }, { "name" : "IS_TEXT", "data-type" : 1, "data-type-len" : 1, "selector" : "is_text", "is-json" : false }, { "name" : "IS_IMAGE", "data-type" : 1, "data-type-len" : 1, "selector" : "is_image", "is-json" : false }, { "name" : "IS_AUDIO", "data-type" : 1, "data-type-len" : 1, "selector" : "is_audio", "is-json" : false }, { "name" : "IS_VIDEO", "data-type" : 1, "data-type-len" : 1, "selector" : "is_video", "is-json" : false }, { "name" : "IS_ZIP", "data-type" : 1, "data-type-len" : 1, "selector" : "is_zip", "is-json" : false }, { "name" : "IS_CONVERTIBLE", "data-type" : 1, "data-type-len" : 1, "selector" : "is_convertible", "is-json" : false } ], "parsed-rows" : 109 }

"data sample"
{ "items": [ { "id": 3, "file_ext": "gif", "mime_type": "image/gif", "markdown_lang": null, "priority": 1, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "N", "is_image": "Y", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" }, { "id": 4, "file_ext": "pdf", "mime_type": "application/pdf", "markdown_lang": null, "priority": 1, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "N", "is_image": "N", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "Y" }, { "id": 5, "file_ext": "markdown", "mime_type": "text/markdown", "markdown_lang": "markdown", "priority": 2, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "Y", "is_image": "N", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" }, { "id": 6, "file_ext": "html", "mime_type": "text/html", "markdown_lang": "html", "priority": 1, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "Y", "is_image": "N", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" }, { "id": 7, "file_ext": "jpg", "mime_type": "image/jpeg", "markdown_lang": null, "priority": 1, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "N", "is_image": "Y", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" }, { "id": 8, "file_ext": "htm", "mime_type": "text/html", "markdown_lang": "html", "priority": 2, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "Y", "is_image": "N", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" }, { "id": 9, "file_ext": "csv", "mime_type": "text/csv", "markdown_lang": "csv", "priority": 1, "is_active": "Y", "created_at": "2026-11-19T10:12:00", "is_text": "Y", "is_image": "N", "is_audio": "N", "is_video": "N", "is_zip": "N", "is_convertible": "N" } ] }
 

While the script is saved in the "Installation Scripts" section of the Supporting Objects, the ZIP files are stored in the Shared Components / Static Application Files.
The following is the corresponding installation script:

begin
    --FILE_EXTENSIONS: 109/10000 rows exported, APEX$DATA$PKG/FILE_EXTENSIONS$191000
    apex_data_install.load_supporting_object_data(p_table_name => 'FILE_EXTENSIONS', p_delete_after_install => true );
end;

In case of multiple tables the script will contain multiple calls to the API.

As long as the tables are made up of simple SQL objects (VARCHAR2, NUMBER, DATES, ...) all works just fine, from the comment included in the script I guess there is a limit of 10000 rows, considering this functionality is meant for moving "static" data I think it's a fair limitation.

The problems may arise if there are tables containing CLOBs longer than 1000 characters or BLOBs.
BLOBs are a show-stopper, the Data Package wizard will return a warning if you try to export a table containing a BLOB column.

CLOBs are successfully imported if they are 1000 characters or less, otherwise they will be truncated.
If you look at the JSON profile file, it will define the column as type 11, 4000 bytes, which explains why they are truncating to 1000 characters in an AL32UTF8 character set (up to 4 bytes per character in AL32UTF8), just to stay safe.

This is why today I submitted an APEX Idea suggesting to handle properly also CLOB and BLOB columns, the latter data type could be base64-encoded to make it easier to deal with in the JSON format.

Aside from a short release video back in APEX 21.2, official documentation on Data Packages is virtually zero, so most of these limits only show up once you test them in the wild. Give the APEX Idea a vote if you'd like to see full CLOB and BLOB support added—and hope you found this helpful!

Thursday, November 05, 2026

DBMS_DEVELOPER.GET_METADATA ignores GRANT SELECT ANY TABLE ON SCHEMA XYZ

I hoped that on Oracle 26ai I could finally leverage schema level privileges and avoid the hassle of granting SELECT explicitly table by table.

grant select any table on schema PB_040000 to TT_020000;

And it works well with SELECT queries and with DESCRIBE too.

Image courtesy of Google Gemini

It works also on tables created after granting the privilege.

But, unfortunately, it turns out that DBMS_DEVELOPER.GET_METADATA ignores the schema level privilege:

--connect as TT_020000

set serveroutput on
begin
dbms_output.put_line(
json_serialize(
dbms_developer.get_metadata(
name => 'ORDERS',
schema => 'PB_040000',
object_type => 'TABLE',
level => 'BASIC'
)
PRETTY
)
);
end;
/

begin
*
ERROR at line 1:
ORA-03408: Object not found : PB_040000.ORDERS
ORA-06512: at "SYS.DBMS_DEVELOPER", line 17
ORA-06512: at "SYS.DBMS_DEVELOPER", line 57
ORA-06512: at line 2


https://docs.oracle.com/error-help/db/ora-03408/


More Details :
https://docs.oracle.com/error-help/db/ora-03408/
https://docs.oracle.com/error-help/db/ora-06512/  

Whether the security model of DBMS_DEVELOPER should change in the future and become compatible with schema level privileges is a valid question in my humble opinion.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles