Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to Swap Two Tables?
RK wrote:
>"nobody" <nobody_at_nowhere.com> wrote in message news:<7mUlb.253604$ko%.218644_at_news04.bloor.is.net.cable.rogers.com>...
>
>
>>tables t1 t2
>>rename t1 to t3;
>>rename t2 to t1;
>>rename t3 to t2;
>>
>>"RK" <rekaben_at_yahoo.com> wrote in message
>>news:239f1935.0310230807.5a9ccbc1_at_posting.google.com...
>>
>>
>>>Assuming space if not a problem, how can I exchange two table content
>>>(two table in same definition and structure) using SQL?
>>>
>>>RK
>>>
>>>
>
>Sorry. Maybe my first post question was unclear enough.
>
>I have two big tables. I want to compare the two table content to see
>if they are identical. If they are not, then I should exchange their
>content.
>
>Please tell me how I can do these two steps using SQL. And for the
>second step, if I am not allowed to create a temp table, how can I do
>it?
>
>Thanks.
>
>RK
>
>
Look at mcstock's answer using the MINUS set operator.
The basic step is:
SELECT col1, col2 FROM tableA
MINUS
SELECT col1, col2 FROM tableB;
-- Daniel Morgan http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Fri Oct 24 2003 - 00:07:40 CDT
![]() |
![]() |