Is it possible to get common query for updating multiple columns in table in sql and oracle . Instead of modifying separate queries with provider type.
Asked
Active
Viewed 463 times
2
-
You've written SQL Server in your title and tagged Oracle? What is your question? – Ben Jun 28 '13 at 09:43
-
I need a common query to update multiple columns of a table in sql server and oracle . – Rakesh Devarasetti Jun 28 '13 at 09:45
-
I'm not well aware on how things work for Oracle, but MERGE should be the way for you to go. – Serge Jun 28 '13 at 09:53
2 Answers
0
The standard ANSI SQL implementation will work with both sql server and oracle
UPDATE <TABLE Name>
SET Col1 = ColValue[, Col2 = Col2Value, .....];
The only thing that you have to put is a semicolon at the end of update statement, as ";" is mandatory statement terminating operator in oracle, where as it is optional in sql server.
NOTE: The clauses that I put in square brackets ([]) are optional.
NOTE 2: UPDATE..FROM is a properietry syntax used by SQL Server, so it cannot be accepted by oracle..
NOTE 3: UPDATE SET (col1,col2) = Col1,Col2 is a syntax supported by oracle but not by sql server.

Surendra
- 711
- 5
- 15
-
1
-
@Serge You are correct there is no from clause in the ANSI syntax, my bad.. edited my solution above... – Surendra Jun 28 '13 at 10:16