Re: Update statement
Date: Fri, 22 Nov 2002 18:38:59 -0800
Message-ID: <arlq2q$rd1$1_at_news.etf.bg.ac.yu>
> I've come from MSSQL to Oracle. Can any Oracle guru tell me if there's a
> mechanism in PLSQL that equates to the transact sql version of update
> that allows the update statement to use more than one table i.e. in TSQL
> you can do
>
> update b
> set b.field1 = t.field1
> from sqlloadtable t, basetable b
> where b.key = t.key
Try this (btw, it's SQL92 compliant, not some PLSQL mechanism and works in Transact SQL as well):
UPDATE b
SET b.field1 = (
SELECT t.field1
FROM sqlloadtable t
WHERE t.key = b.key)
WHERE b.key IN (
SELECT key
FROM sqlloadtable)
It's from the top of my head, and not tested...
> Basically, I have a table that I'm updating from data sent in a file
> that's loaded into a worktable using sqlload.
>
> Thanks in advance.
>
> Would appreciate email copies of replies to
> wayne.smith_at_rbs.co.uk
>
> --
> Posted via http://dbforums.com
-- Regards, Damjan S. Vujnovic University of Belgrade School of Electrical Engineering Department of Computer Engineering & Informatics Belgrade, Yugoslavia http://galeb.etf.bg.ac.yu/~damjan/Received on Sat Nov 23 2002 - 03:38:59 CET