Using > operators in SAP HANA

When working with SAP HANA queries that contain comparison operators like > (greater than) in XML contexts, you need to use CDATA sections. The term CDATA means Character Data. CDATA is defined as blocks of text that are not parsed by the XML parser, but are otherwise recognized as markup.

The predefined XML entities such as <, >, and & require entity encoding and are generally difficult to read in the markup. Instead of writing &gt; for the greater than operator, CDATA sections allow you to use the actual > symbol directly.

CDATA Section Syntax

Following is the syntax for CDATA section ?

<![CDATA[
characters with markup
]]>

Example

You have to wrap your SAP HANA queries in CDATA sections as shown below ?

<root>
    <query>
        <![CDATA[
        SELECT vbeln FROM vbpa WHERE posnr > 50;
        ]]>
    </query>
</root>

This approach eliminates the need to escape the greater than operator as &gt; and makes your queries more readable within XML documents.

Benefits of Using CDATA

Using CDATA sections provides several advantages ?

  • Readability ? Queries remain in their natural SQL format
  • Maintenance ? No need to escape special characters manually
  • Error Prevention ? Reduces syntax errors from incorrect entity encoding

For more details about XML CDATA, you can refer to ? XML CDATA Sections Tutorial

Conclusion

CDATA sections provide an elegant solution for embedding SAP HANA queries with comparison operators in XML contexts, eliminating the need for entity encoding while maintaining code readability.

Updated on: 2026-03-13T18:24:14+05:30

214 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements