Search code examples
mysqlextract-value

ExtractValue function of mysql not working


select extractvalue( SELECT CONCAT("'",(SELECT LCASE('<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resp>
<dlrdtls>
<MessageId>43745973-737b-4c71-926f-797c0c9407a6</messageid>
<deliverystatus>failed</deliverystatus>
</dlrdtls>
</resp>')),"'"),'/resp/dlrdtls/messageid')  
as id ;

I want to extract value for tag MessageId.


Solution

  • Remove the inner SELECT statments like

    SELECT EXTRACTVALUE(CONCAT("'",(LCASE('<?xml version="1.0" encoding="utf-8" standalone="no"?>
    <resp>
    <dlrdtls>
    <MessageId>43745973-737b-4c71-926f-797c0c9407a6</messageid>
    <deliverystatus>failed</deliverystatus>
    </dlrdtls>
    </resp>')),"'"),'/resp/dlrdtls/messageid')  
    AS id ;
    

    the query works this way but in reality the CONCAT function is also not needed