Home

DBMS_XMLTRANSLATIONS package is desupported

Description

    The DBMS_XMLTRANSLATIONS package has been desupported in Oracle Database 18c and later. This package was previously used for XML translation functions, but Oracle recommends using modern XML processing tools and functions instead.

    Continuing to use this package may result in runtime errors or compatibility issues during upgrades.

Key Benefits

  • Improved Compatibility: Ensures the application remains compatible with current and future Oracle Database versions.
  • Avoid Runtime Failures: Prevents potential errors due to usage of unsupported features.
  • Modern Codebase: Encourages use of supported XML handling alternatives, improving maintainability and performance.

 

Non-compliant Code Example

/*  Works only on versions that still include DBMS_XMLTRANSLATIONS  */
SET SERVEROUTPUT ON
DECLARE
  -- 1. Base XML with English + French titles
  v_doc XMLTYPE := XMLTYPE(
'
  Security Class Example
  Exemple de classe de sécurité – FR
');
  v_out XMLTYPE;
BEGIN
  ------------------------------------------------------------------
  -- 2. Return the document in French
  v_out := DBMS_XMLTRANSLATIONS.translateXML(v_doc, 'fr');            --Non compliant code (DBMS_XMLTRANSLATIONS package is desupported)
  DBMS_OUTPUT.put_line('French copy:');
  DBMS_OUTPUT.put_line(v_out.getstringval);

  ------------------------------------------------------------------
  -- 3. Update the French translation in place
  v_doc := DBMS_XMLTRANSLATIONS.updateTranslation(                   --Non compliant code (DBMS_XMLTRANSLATIONS package is desupported)
              doc       => v_doc,
              xpath     => '/securityClass/title/text()',
              lang      => 'fr',
              value     => 'Classe de sécurité (modifiée)');

  ------------------------------------------------------------------
  -- 4. Extract all title translations as XLIFF
  v_out := DBMS_XMLTRANSLATIONS.extractXLIFF(                        --Non compliant code (DBMS_XMLTRANSLATIONS package is desupported)
              doc       => v_doc,
              xpath     => '/securityClass/title');
  DBMS_OUTPUT.put_line('Generated XLIFF:');
  DBMS_OUTPUT.put_line(v_out.getstringval);

  ------------------------------------------------------------------
  -- 5. Temporarily switch OFF language awareness
  DBMS_XMLTRANSLATIONS.disableTranslation;                           --Non compliant code (DBMS_XMLTRANSLATIONS package is desupported)
  /* Queries that follow now read the *source* string only          */

  ------------------------------------------------------------------
  -- 6. Re-enable translations (default session behaviour)
  DBMS_XMLTRANSLATIONS.enableTranslation;                            --Non compliant code (DBMS_XMLTRANSLATIONS package is desupported)
END;
Visual Expert 2025
 VEPLSQLRULE204