cancel
Showing results for 
Search instead for 
Did you mean: 

Escape Characters in Dynamic Queries in HANA

Former Member
0 Kudos


Hi All,

We are using Dynamic Queries in our Stored procedure and sometimes we need to use string literals (e.g. 'abc' or "YEAR_MONTH"||'01') in the query. Can anyone share the escape character which we need to use for single quote(') or for concatenation symbol (||)? I know I can first initialize a variable and use that variable in the query, but it will be nice to know, what should be the escape character if I need to hard code these literals in the query.

Regards,

Piyush

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member182302
Active Contributor
0 Kudos

Hi Piyush,

You may want to check the dynamic sql statements in this blog

Regards,

Krishna Tangudu

0 Kudos

Pls try below in place of quote

'''||'

For "YEAR_MONTH"||'01',  EXECUTE IMMEDIATE 'SELECT "YEAR_MONTH"||'''||'01'''||' FROM <<table_name>>' ;

Regards,

Ram