1
votes

I am trying to pass the columnName to a tcl sql update query. I am aware I can pass dynamic values of columns with [list :substitutedParam $itsValue] format where I have already set the value of variable itsValue but I am not able to make it work with update. here is what I am trying :

set returncode [catch { SQL "UPDATE schemaName.TableName SET :columnName='u' WHERE key=$keyValue" [list columnName $attr ]} result]

In above, only solution I am looking for is: Is at all possible to pass columnName when and what I prefer so I can use the same sql query to update multiple columns (not simultaneously offcourse).

tcl version :8.4
database: Oracle 18c
1

1 Answers

1
votes

I might be wrong, but I think you can only use parameters with value parts of the query

set returncode [catch {
    SQL "UPDATE schemaName.TableName SET $attr='u' WHERE key=:key" [list key $keyValue]
} result]