Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dynamic Update Statement in Native SQL

abhishek_katti
Explorer
0 Likes
1,025

Hi Experts,

I want to dynamically pass the field in Update statement in Native SQL. For eg.

data: str1 type string.

str1 = 'MARKETS'.

EXEC SQL.

UPDATE PRDT.TBVEHDS4 SET (str1) = :'U'

WHERE VEH_NO = :'K1WK-54520'

AND SEGMENT_NO = :'01'

ENDEXEC.

But this is not taking (str1) as MARKETS field to update as U , its taking STR1 itself, Giving native SQL exception as Invalid Token as we are using DB2 as external DB system.

I checked with field-symbols also, but nothing helped.

Please help, thanks in Advance.

Regards,

Abhishek

1 REPLY 1
Read only

Former Member
0 Likes
471

Hi,

Check this demo program in SE38 ADBC_DEMO, take as example to construct your own dynamic native sql

Regards,

Felipe