Update from solution in oracle

xiaoxiao2021-03-05  25

Update from solution in oracle

There is no Update from function similar to SQL Server in Oracle to a solution to / * formatted on 2004/10/26 11:15 (Formatter Plus v4.5.2) * / update Tablea a set a.fieldforupdate = (Select B.fieldsource from Tableb b where a.keyfield = B.Keyfield) Where exists (SELECT B.FIELDSOURD) WHERE EXISTS (SELECT B.FIELDSOURD = B. Keyfield) Example Table Text Fielda Fieldb Fieldc 1 2004-1-1 2004-2-1 2 2004 2-2 2004-3-1 3 2004-3-1 2004-4-1 If you want to update the C field value of record 1 according to the record 2, you can use the following SQL / * Formatted On 2004/10/26 11 : 25 (Formatter Plus v4.5.2) * / update text a set a.fieldb = (Select B.fieldb from get b where A.fielda = B.fielda and b.fieldb> a.fieldb and b.fieldb - a. Fieldb <= 35) Where exists (SELECT B.FIELDB FROM TEXT B Where A.fielda = B.fielda And B.fieldb> a.fieldb and b.fieldb - a.fieldb <= 35)

[

Click here to favor this article]

Published on October 26, 2004 12:21 PM

HREF = "http://blog.9cbs.net/phpnewbie/services/pingback.aspx" Rel = "pingback" />

ZZZ Posted

2004-12-16 7:47 AM

There is no UPDATE FROM function similar to SQL Server in Oracle.

A solution is

/ * Formatted on 2004/10/26 11:15 (Formatter Plus v4.5.2) * /

Update Tablea A

Set a.fieldforupdate =

(Select B.fieldsource

From Tableb B

Where a.keyfield = B.Keyfield

WHERE EXISTS

SELECT B.FIELDSOURCE

From Tableb B

Where a.keyfield = B.Keyfield

SELECT B.fieldsource in this statement

From Tableb B

Where a.keyfield = B.Keyfield can only be a specific value, can't be a data set

转载请注明原文地址:https://www.9cbs.com/read-36384.html

New Post(0)