1

The table in Sybase database has a column which is of type 'text' say 'myXML'. This column stores entire XML. I need to retrieve data based on specific value stored in the XML. For exmaple, in the below table I need to get all the rows which has the OPTIONAL_TAG in myXML column data.

myId | myXML
-------------------------------
1    | <?xml version="1.0" encoding="UTF-8"?>
       <MAIN_TAG>
         value_01
       <MAIN_TAG>
-----------------------------------------------
2    | <?xml version="1.0" encoding="UTF-8"?>
       <MAIN_TAG>
         value_01
       <MAIN_TAG>
       <OPTIONAL_TAG></OPTIONAL_TAG>

Parsing in java code is one option and another is the like query. But I want to know if there is any other way to do the same in DB itself? Thanks.

0 Answers0