cancel
Showing results for 
Search instead for 
Did you mean: 

hana dynamic sql help

Former Member
0 Kudos

Hi All,

I am bulding a below dynamic sql in hana stored procedure, can some one help what is the issue on the below syntax

exec ( 'ALTER TABLE ' || schema_name || '."' || table_name || '" add (' || column_name ||'1' || col_type || ')');

It throws me

line 34 col 1 (at pos 1240): [257] (range 3) sql syntax error exception: sql syntax error: incorrect syntax near ")": line 1 col 54 (at pos 54)

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Looks like you have missed that the variables need to have colons (:) in front of the variable name when you want to refer to their value.

Fix that and make sure that the col_type variable contains a valid definition for a column type.

Former Member
0 Kudos

Thanks Lars i have fixed the issue it is ||'1 ' || instead of ||'1' ||, Thanks

Answers (0)