Very simple question, is it possible to write an Oracle update statement like this with column names and values grouped together?
UPDATE table_name SET (column1, column2, column3) = (value1, value2, value3)
The reason I’m asking is because I’m writing a script to migrate a lot of data and for insert statements I have a string containing all the column names and a string containing all the values. I need to write an update statement for the same data and was wondering if there’s an alternative to having to write it all out again in a different format!
Not directly as you wrote it, but you can do it like this:
So a multi-column update is only supported when using a sub-select for the “value”.
You might also want to look into the MERGE statement:
If that row exists it will be updated, if not it will be inserted.