Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Dimension table load - PLSQL question

Dimension table load - PLSQL question

2005-09-29       - By Ranko Mosic

Reply:     <<     11     12     13     14     15     16     17     18     19     20     >>  

That's for 10g. I am on 9.2 here.
thanks, rm

On 9/29/05, Igor Neyman <ineyman@(protected)> wrote:
>
> From Oracle docs:
>
> "merge_insert_clause
> .....................................
> .....................................
> You can specify this clause by itself or with the merge_update_clause.
> If you specify both, then they can be in either order."
>
>
> __ ____ ____ ____ ____ ____ ____
>
> From: oracle-l-bounce@(protected)
> [mailto:oracle-l-bounce@(protected)] On Behalf Of Ranko Mosic
> Sent: Thursday, September 29, 2005 9:51 AM
> To: Igor Neyman
> Cc: Paul Drake; ORACLE-L
> Subject: Re: Dimension table load - PLSQL question
>
>
> Not in my test - I tried to omitt "matched" and it won't do.
> SQL> l
> 1 MERGE INTO bonuses D
> 2 USING (SELECT employee_id, salary, department_id FROM employees
> 3 WHERE department_id = 80) S
> 4 ON (D.employee_id = S.employee_id)
> 5 WHEN NOT MATCHED THEN INSERT (D.employee_id, D.bonus)
> 6* VALUES (S.employee_id, S.salary*0.1)
> SQL> /
> VALUES (S.employee_id, S.salary*0.1)
> *
> ERROR at line 6:
> ORA-00905 (See ORA-00905.ora-code.com): missing keyword
> rm
>
> On 9/29/05, Igor Neyman <ineyman@(protected)> wrote:
>
> "when matched" clause is optional, so you should be fine without
> updates.
> As for returning PK, regular "INSERT" has "RETURNING" clause,
> but I don't see one for "insert" used withing "MERGE". File
> "enhancement request" with Oracle :)
>
> __ ____ ____ ____ ____ ____ ____
>
> From: oracle-l-bounce@(protected) [mailto:
> oracle-l-bounce@(protected) <mailto:oracle-l-bounce@(protected)> ]
> On Behalf Of Ranko Mosic
> Sent: Thursday, September 29, 2005 9:34 AM
> To: Igor Neyman
> Cc: Paul Drake; ORACLE-L
>
> Subject: Re: Dimension table load - PLSQL question
>
>
>
> What about returning key if record exists ? There is no
> update happening.
>
> Thanks, rm.
>
>
> On 9/29/05, Igor Neyman <ineyman@(protected)
> <mailto:ineyman@(protected)> > wrote:
>
> Does it make a difference: 1 table or 6?
>
> MERGE INTO t
> USING (SELECT(select descr1 from lkp_table1 where cd
> = p_cd1) AS v_descr1,
> select descr2 from
> lkp_table2 where cd = p_cd2) AS v_descr2 ,
> .... etc. )from dual) c
> ON (t.descr1 = c.v_descr1 and t.descr2 = c.v_descr2
> and ... etc)
> WHEN NOT MATCHED INSERT (t.descr1, t.descr2, ...)
> VALUES (c.v_descr1, c.v_descr2, ...)
>
> Really, no need to react the way, you did...
>
> Igor Neyman
>
>
> __ ____ ____ ____ ____ ____ ____
>
> From: oracle-l-bounce@(protected) [mailto:
> oracle-l-bounce@(protected) <mailto:oracle-l-bounce@(protected)> ]
> On Behalf Of Ranko Mosic
> Sent: Thursday, September 29, 2005 8:45 AM
> To: Paul Drake
> Cc: ORACLE-L
> Subject: Re: Dimension table load - PLSQL question
>
>
> Thanks for very helpful, no patronizing answer. If
> you've read more carefully what the problem is
> you'd see that MERGE can't work because it works on one
> table upserting another.
> I have one table being inserted from 6 tables.
> Thanks genius.
>
>
> On 9/28/05, Paul Drake <bdbafh@(protected)> wrote:
>
> On 9/28/05, Ranko Mosic <ranko.mosic@(protected) >
> wrote:
>
> Hi,
> requirement:
> - input parameters are codes p_cd1,
> p_cd2, ...
> - for these codes I get descriptions (
> select descr1 into v_descr1 from
>
> lkp_table1 where cd = p_cd1; select
> descr2 into v_descr2 from lkp_table2 where
>
> cd = p_cd2 etc )
> - check if table t has records where
> t.descr1 = v_descr1
> and t.descr2 = v_descr2 and on and on
> ....;
> - if row exists return primary key;
> - if not then insert.
>
> What is the best way of doing it (
> simplest ) ?
>
>
> Regards, Ranko.
>
>
>
>
> Ranko,
>
> "Simplest way" is to solicit opinions without
> using a search engine or checking the documentation.
> Its also usually "simplest" to leverage the
> existing provided functionality, rather than writing your own routines,
> error handling, etc.
>
> A search of "oracle 10.1 upsert" in google.com <http://google.com>
> <http://google.com/> + "I'm feeling lucky" produced this for me.
> Perhaps you might get lucky too.
>
> Paul
>
> http://www.psoug.org/reference/merge.html
>
>
>
> MERGE <hint> INTO <table_name>
> USING <table_view_or_query>
> ON (<condition>)
> WHEN MATCHED THEN <update_clause>
> WHEN NOT MATCHED THEN <insert_clause>;
>
>
>
>
>
>

<div>That's for 10g. &nbsp;I am on 9.2 here. </div>
<div>thanks, rm<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 9/29/05, <b class="gmail_sendername">Igor
Neyman</b> &lt;<a href="mailto:ineyman@(protected)">ineyman@(protected)<
/a>&gt; wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0
.8ex; BORDER-LEFT: #ccc 1px solid">From Oracle docs:<br><br>&quot;merge_insert
_clause<br>.....................................<br>............................
.........
<br>You can specify this clause by itself or with the merge_update_clause.<br
>If you specify both, then they can be in either order.&quot;<br><br><br>__ ____
__ ____ ____ ____ ____ __<br><br>From: <a href="mailto:oracle-l-bounce@(protected)
.org">
oracle-l-bounce@(protected)</a><br>[mailto:<a href="mailto:oracle-l-bounce
@(protected)">oracle-l-bounce@(protected)</a>] On Behalf Of Ranko Mosic<br
>Sent: Thursday, September 29, 2005 9:51 AM<br>To: Igor Neyman<br>Cc: Paul Drake
; ORACLE-L
<br>Subject: Re: Dimension table load - PLSQL question<br><br><br>Not in my
test - I tried to omitt &quot;matched&quot; and it won't do.<br>SQL&gt; l<br>1
&nbsp;&nbsp;MERGE INTO bonuses D<br>2&nbsp;&nbsp;USING (SELECT employee_id,
salary, department_id FROM employees
<br>3&nbsp;&nbsp;WHERE department_id = 80) S<br>4&nbsp;&nbsp;ON (D.employee_id
= S.employee_id)<br>5&nbsp;&nbsp;WHEN NOT MATCHED THEN INSERT (D.employee_id, D
.bonus)<br>6* VALUES (S.employee_id, S.salary*0.1)<br>SQL&gt; /<br>VALUES (S
.employee_id, S.salary*0.1
)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br>ERROR at line 6:<br
>ORA-00905 (See ORA-00905.ora-code.com): missing keyword<br>rm<br><br>On 9/29/05, Igor Neyman &lt;<a href=
"mailto:ineyman@(protected)">ineyman@(protected)</a>&gt; wrote:<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;when matched&quot; clause is optional
, so you should be fine without
<br>updates.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; As for returning PK,
regular &quot;INSERT&quot; has &quot;RETURNING&quot; clause,<br>but I don't see
one for &quot;insert&quot; used withing &quot;MERGE&quot;.&nbsp;&nbsp;File<br>
&quot;enhancement request&quot; with Oracle :)
<br><br>__ ____ ____ ____ ____ ____ ____<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; From: <a href="mailto:oracle-l-bounce@(protected)">oracle-l-bounce
@(protected)</a> [mailto:<br><a href="mailto:oracle-l-bounce@(protected)"
>oracle-l-bounce@(protected)
</a> &lt;mailto:<a href="mailto:oracle-l-bounce@(protected)">oracle-l-bounce
@(protected)</a>&gt; ]<br>On Behalf Of Ranko Mosic<br>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; Sent: Thursday, September 29, 2005 9:34 AM<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; To: Igor Neyman<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cc:
Paul Drake; ORACLE-L
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: Re: Dimension table load
- PLSQL question<br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What about returning key if record exists ?
There is no<br>update happening.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thanks, rm.<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 9/29/05, Igor
Neyman &lt;
<a href="mailto:ineyman@(protected)">ineyman@(protected)</a><br>&lt
;mailto:<a href="mailto:ineyman@(protected)">ineyman@(protected)</a>&gt;
&gt; wrote:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Does it make a difference: 1 table or 6?
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp; MERGE INTO t<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING (SELECT
(select descr1 from lkp_table1 where cd<br>= p_cd1) AS v_descr1,<br>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select descr2 from<br>lkp_table2 where cd = p_cd2
) AS v_descr2 ,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .... etc. )from dual) c<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ON (t.descr1 = c.v_descr1 and t.descr2 = c.v
_descr2<br>and ... etc)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN NOT MATCHED INSERT
(t.descr1,
t.descr2, ...)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VALUES
(c.v_descr1, c.v_descr2, ...)<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Really, no need to react the way, you
did...<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp; Igor Neyman<br><br><br>__ ____ ____ ____ ____ ____ ____
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp; From: <a href="mailto:oracle-l-bounce@(protected)">oracle-l
-bounce@(protected)</a> [mailto:<br><a href="mailto:oracle-l-bounce@(protected)
.org">oracle-l-bounce@(protected)</a> &lt;mailto:<a href="mailto:oracle-l
-bounce@(protected)">
oracle-l-bounce@(protected)</a>&gt; ]<br>On Behalf Of Ranko Mosic<br>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Sent: Thursday, September 29, 2005 8:45 AM<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: Paul Drake<br>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Cc: ORACLE-L<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; Subject: Re: Dimension table load - PLSQL question
<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; Thanks for very helpful, no patronizing answer. If<br>you've
read more carefully what the problem is<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; you'd see that MERGE can't work
because it works on one<br>table upserting another.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; I have one table being inserted from 6 tables.<br>&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thanks
genius.<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; On 9/28/05, Paul Drake &lt;<a href="mailto:bdbafh@(protected)
.com">bdbafh@(protected)</a>&gt; wrote:<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On 9/28/05, Ranko
Mosic &lt;<a href="mailto:ranko.mosic@(protected)">ranko.mosic@(protected)</a> &gt;
<br>wrote:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hi,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
requirement:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - input parameters are codes p_cd1,<br>p_cd2, ...
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - for these codes I get descriptions (<br>select
descr1 into v_descr1 from<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lkp_table1 where cd
= p_cd1; select
<br>descr2 into v_descr2 from lkp_table2 where<br><br>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
cd = p_cd2 etc )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - check if table t has records&nbsp;
&nbsp;where<br>t.descr1 = v_descr1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;and
t.descr2 = v_descr2 and on and on<br>....;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - if
row exists return primary key;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - if not then
insert.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What is the best way of doing it (
<br>simplest ) ?<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Regards, Ranko.<br><br>
<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Ranko,<br><br>&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Simplest way&quot; is to
solicit opinions without
<br>using a search engine or checking the documentation.<br>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Its also usually &quot;simplest&quot; to
leverage the<br>existing provided functionality, rather than writing your own
routines,<br>error handling, etc.
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A search of &quot
;oracle 10.1 upsert&quot; in <a href="http://google.com">google.com</a><br>&lt;
<a href="http://google.com/">http://google.com/</a>&gt;&nbsp;&nbsp;+ &quot;I'm
feeling lucky&quot; produced this for me.
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Perhaps you might
get lucky too.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Paul<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http
://www.psoug.org/reference/merge.html">http://www.psoug.org/reference/merge.html
</a>
<br><br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MERGE &lt;hint&gt; INTO &lt;table
_name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; USING &lt
;table_view_or_query&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; ON (&lt;condition&gt;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; WHEN MATCHED THEN &lt;update_clause&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WHEN NOT MATCHED
THEN &lt;insert_clause&gt;;<br><br><br><br><br><br></blockquote></div><br>