Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL help
On Sep 25, 12:06 pm, Laura <laura.pater..._at_gmail.com> wrote:
> Hi,
>
> I hope this is the correct group to post in - any help is appreciated.
>
> I am writing some SQL to populate or update an Oracle table. I
> currently run this through JDBC, however, it will probably end up as a
> PL/SQL procedure.
>
> What I want to do is UPDATE a row if it currently exists in the
> database - however, if it doesn't already exist, I want to CREATE it
> with the new values.
>
> I'm sure this must be a fairly common thing to do - however, my
> searches for an answer have been unsuccessful... I would prefer not
> to have to run a separate query in my code to determine whether an
> update or insert is required.
>
> Thanks,
> - Laura
Hi Laura,
If you are on at least Oracle 9.x, look up MERGE in the docs...
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9016.htm#i2081218
HTH, Steve Received on Tue Sep 25 2007 - 11:13:57 CDT
![]() |
![]() |