Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: "insert or update" in one step?
MySQL has it:
"7.22 REPLACE Syntax
REPLACE [LOW_PRIORITY | DELAYED]
[INTO] tbl_name [(col_name,...)] VALUES (expression,...) or REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [(col_name,...)] SELECT ... or REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name SET col_name=expression, col_name=expression,...
REPLACE works exactly like INSERT, except that if an old record in the table has the same value as a new record on a unique index, the old record is deleted before the new record is inserted. See section 7.21 INSERT Syntax."
In article <991313547.19776.0.nnrp-12.9e984b29_at_news.demon.co.uk>,
jonathan_at_jlcomp.demon.co.uk says...
>
>
>Not necessarily a joke, UPSERT has been a valid
>command in one of the major databases (Teradata
>I think) for several years, and the question: 'I want to
>insert a row, or update it if it exists, what's the
>efficient method ?' is a prime candidate for any
>Oracle FAQ. (There was yet another thread started
>on it in the last few days).
>
>
>--
>Jonathan Lewis
>Yet another Oracle-related web site: http://www.jlcomp.demon.co.uk
>
>Practical Oracle 8i: Building Efficient Databases
>Publishers: Addison-Wesley
>
>Reviews at: http://www.jlcomp.demon.co.uk/book_rev.html
>
>
>
>Patrick Sinke wrote in message <991311196.576145_at_sleeper.capgemini.nl>...
>>> In Orace9i you will have the command 'UPSERT' at your disposal.
>>>
>>
>>this must be a joke!
>>Maybe there will be a combined update/delete statement? Like uplete or
>>delate? ;)
>>
>>Regards,
>>Patrick.
>>
>>
>>
>
>
Received on Thu May 31 2001 - 15:27:52 CDT
![]() |
![]() |