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 rjamya

Reply:     1     2     3     4     5     6     7     8     9     10     >>  

Ronko,

there is no need to be tasty ... you didn't specify that you will be reading
from 6 table and inserting into one in your op. did you?

Raj

On 9/29/05, Ranko Mosic <ranko.mosic@(protected)> wrote:
>
> 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/> +
> > "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>;
> >
>
>


--
-- ---- ---- ---- ---- ---- --
select standard_disclaimer from company_requirements where category =
'MANDATORY';

Ronko,<br>
<br>
there is no need to be tasty ... you didn't specify that you will be
reading from 6 table and inserting into one in your op. did you?<br>
<br>
Raj<br><br><div><span class="gmail_quote">On 9/29/05, <b class="gmail
_sendername">Ranko Mosic</b> &lt;<a href="mailto:ranko.mosic@(protected)">ranko
.mosic@(protected)</a>&gt; wrote:</span><blockquote class="gmail_quote" style=
"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding
-left: 1ex;">
<div>Thanks for very helpful, no patronizing answer. If you've read more
carefully what the problem is</div>
<div>you'd see that MERGE can't work because it works on one table upserting
another. </div>
<div>I have one table being inserted from 6 tables. </div>
<div>Thanks genius.<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 9/28/05, <b class="gmail_sendername">Paul
Drake</b> &lt;<a href="mailto:bdbafh@(protected)" target="_blank" onclick="return
top.js.OpenExtLink(window,event,this)">bdbafh@(protected)</a>&gt; wrote:
</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204
); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<div><span>On 9/28/05, <b class="gmail_sendername">Ranko Mosic</b> &lt;<a href=
"mailto:ranko.mosic@(protected)" target="_blank" onclick="return top.js
.OpenExtLink(window,event,this)">ranko.mosic@(protected)
</a>&gt; wrote:
<div><span class="gmail_quote"></span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204
); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><pre>Hi, <br>requirement: <br>
- input parameters are codes p_cd1, p_cd2, ...<br>- for these codes I get
descriptions ( select descr1 into v_descr1 from
<br><br>lkp_table1 where cd = p_cd1; select descr2 into v_descr2 from lkp
_table2 where <br><br>cd = p_cd2 etc )<br>- check if table t has records  where
t.descr1 = v_descr1<br>   and t.descr2 = v_descr2 and on and on ....;
<br>- if row exists return primary key; <br>- if not then insert. <br><br>What
is the best way of doing it ( simplest ) ? <br><br><br>Regards, Ranko.  <br><
/pre><br></blockquote></div><br></span></div>Ranko,<br><br>&quot;Simplest way
&quot; is to solicit opinions without using a search engine or checking the
documentation.
<br>Its
also usually &quot;simplest&quot; to leverage the existing provided
functionality, rather than writing your own routines, error handling,
etc.
<br><br>A search of &quot;oracle 10.1 upsert&quot; in <a href="http://google
.com/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"
>google.com</a> + &quot;I'm feeling lucky&quot; produced this for me.
<br>Perhaps you might get lucky too.<br><br>Paul<br><br><a href="http://www
.psoug.org/reference/merge.html" target="_blank" onclick="return top.js
.OpenExtLink(window,event,this)">http://www.psoug.org/reference/merge.html
</a>
<br><br>
<table bgcolor="#d8d8c4" border="1" width="90%">
<tbody>
<tr>
<td rowspan="2" width="25%"><br></td>
<td width="75%"><font face="Courier">MERGE &lt;hint&gt; INTO &lt;table_name&gt;
<br>USING &lt;table_view_or_query&gt;<br>ON (&lt;condition&gt;)<br>WHEN MATCHED
THEN &lt;update_clause&gt;<br>WHEN NOT MATCHED THEN &lt;insert_clause&gt;;
</font></td></tr></tbody></table><br></blockquote></div><br>

</blockquote></div><br><br clear="all"><br>-- <br>-- ---- ---- ---- ---- ------
-<br>select standard_disclaimer from company_requirements where category =
'MANDATORY';<br>