One of my database table has multiple records. In each record there is a column which stores the XML of following type . I need to write a query which should fetch the records wherein inside the parent node ,if any of the sub node contains only the value 0 entirely. In this example, the fourth node contains all 0. This satisfies the condition and the record must be fetched. May I know how to write this condition in SQL to fetch like this?
Note : The parent node may contain multiple sub nodes.
XML:
<videoDetails>
<video>
<V1>
<display>0</display>
</V1>
<V2>
<display>0</display>
</V2>
<V3>
<display>0</display>
</V3>
<V4>
<display>0</display>
</V4>
<V5>
<display>1</display>
</V5>
</video>
<video>
<V1>
<display>0</display>
</V1>
<V2>
<display>0</display>
</V2>
<V3>
<display>1</display>
</V3>
<V4>
<display>0</display>
</V4>
<V5>
<display>0</display>
</V5>
</video>
<video>
<V1>
<display>0</display>
</V1>
<V2>
<display>1</display>
</V2>
<V3>
<display>0</display>
</V3>
<V4>
<display>0</display>
</V4>
<V5>
<display>1</display>
</V5>
</video>
<video>
<V1>
<display>0</display>
</V1>
<V2>
<display>0</display>
</V2>
<V3>
<display>0</display>
</V3>
<V4>
<display>0</display>
</V4>
<V5>
<display>0</display>
</V5>
</video>
</videoDetails>
I tried to use something like NOT xmlexists('$N/../../../videoDetails/video[1]/*[display=1]' passing USER_VIDEO_XML as "N") . This works only when the XML contains one node which has all 0 and doesn't work with multiple nodes.
Request your valuable inputs.