Skip to Content
0
Former Member
Jan 14, 2009 at 08:56 AM

Dynamic update statement

1866 Views

Hello,

How do I write a dynamic UPDATE statement that I need to look like this:

DATA: TABLE_NAME(10),

COL_NAME1(10),

COL_NAME2(10),

COL_NAME3(10).

table_name = 'TABLEX'

COL_NAME1 = 'COL1X'.

COL_NAME2 = 'COL2X'.

COL_NAME3 = 'COL3'X.

UPDATE table_name SET col_name1 = VAR1 col_name2 = VAR2 col_name3 = VAR3.

table_name = 'TABLEY'

COL_NAME1 = 'COL1Y'.

COL_NAME2 = 'COL2Y'.

COL_NAME3 = 'COL3Y'.

UPDATE table_name SET col_name1 = VAR1 col_name2 = VAR2 col_name3 = VAR3.

Thank you.