Update statement syntax? 
Author Message
 Update statement syntax?
The UPDATE statement in Transact-SQL can take the form:
UPDATE tableA
  Set col = <expression>, ...
  FROM TableB, TableC
 WHERE <condition> ;

Is there a similar feature in Oracle syntax?  The rows in TableA that need
to be updated are based upon how they join to TableB and TableC.

Thanks,
Paul Horan



Tue, 07 Aug 2001 03:00:00 GMT
 Update statement syntax?

HoMan wrote

Quote:
>The UPDATE statement in Transact-SQL can take the form:
>UPDATE tableA
>  Set col = <expression>, ...
>  FROM TableB, TableC
> WHERE <condition> ;

update tableA a
set ( a.col1, a.col2 ) =
    ( select b.col3, c.col4
      from tableB b, tableC c
      where b.id1 = a.id1
      and b.id2 = c.id2
    )
, a.col3 =
    ( select d.col1
      from tableD d
      where d.id1 = a.id2
    )
where a.col3 <=
    ( select max( e.col1 )
      from tableE e
    )
and ( a.col4, a.col5 ) =
    ( select f1.col1, f1.col2
      from tableF f1
      where f1.id1 = a.id3
    )
and a.col6 in
    ( select distinct f2.col3
      from tableF f2
      where f2.id2 = a.id3
    );

Get the picture? :-)

The only thing you cannot do is update two tables in one statement, like

update tableA a, tableB b
set a.col1 = ..., b.col1 = ...
where a.col3 = b.col4;

Arjan.



Wed, 08 Aug 2001 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Help with SQL update statement syntax

2. SQL Update Statement Syntax Help

3. UPDATE statement syntax

4. Update Statement Syntax

5. Update statement syntax -- Please Help!!

6. (0x80040E14) Syntax error in UPDATE statement.

7. NEWBIE: easy syntax question with UPDATE statement

8. Syntax error in UPDATE statement while using a Memo field

9. Need help with Syntax on Update or Insert SQL Statement

10. (0x80040E14) Syntax error in UPDATE statement.

11. Syntax error in UPDATE statement

12. HE: Syntax Error in UPDATE statement


 
Powered by phpBB® Forum Software