2013-05-27 83 views
4

我在大容量表上有Update Statement。 它一次只更新一行。Oracle更新並返回值

Update MyTable 
Set Col1 = Value 
where primary key filters 

有了這個更新語句被執行我也想在返回的值,以避免Select Query在同一個表,以節省資源。 我的語法是什麼?

回答

7

可以使用復出關鍵字。

Update MyTable 
Set Col1 = Value 
where primary key filters 
returning column1,column2... 
into variable1,variable2... 
0

如果您確信它更新只有一行,寫相同的過濾器選擇查詢,如:

SELECT * FROM MyTable 
where primary key filters 
+0

我需要在一次。這是可能的MSSQL。 [見這裏](http://stackoverflow.com/questions/700786/sql-update-a-row-and-returning-a-column-value-with-1-query) – Romesh