Diogo Basilio
Diogo Basilio

Reputation: 11

Deleting part of an XML using PL/SQL

I am trying to delete the end part of a xml file and save it into a variable.

The xml has something similar to this structure:

<what_to_delete>
    <Body_of_what_to_Delete>
        several strings of characters i want to delete
        spreaded across several lines.
    </Body_of_what_to_Delete>
</what_to_delete>

I want to know if there exists a suitable function in PL/SQL that implements this request.

Something like delete from '<what_to_delete>' to '</what_to_delete>':

DELETE_FROM(file_to_trim, '<what_to_delete>', '</what_to_delete>');

This is supposed to be in several xml files and not just in one. Also, what I want to delete varies widely from file to file, so a "delete from '' up to ''" would be the most suitable way.

Upvotes: 0

Views: 301

Answers (1)

Thomas Kirchhoff
Thomas Kirchhoff

Reputation: 978

You can use DELETEXML.

UPDATE your_table
  SET your_col = deleteXML(your_col, '//what_to_delete');

Upvotes: 1

Related Questions