Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: what is the fastest way to update a big table with more than

RE: what is the fastest way to update a big table with more than

From: Cale, Rick T (Richard) <RICHARD.T.CALE_at_saic.com>
Date: Wed, 31 Oct 2001 07:15:31 -0800
Message-ID: <F001.003B94B1.20011031073521@fatcity.com>

When you create the new table with char(8), I would use varchar2(8) but, do a trim when inserting into the new table because in your old table since it is char(255) it is blank padded so you are trying to put length of 255 into a length of 8.

HTH
Rick

-----Original Message-----
Sent: Wednesday, October 31, 2001 8:50 AM To: Multiple recipients of list ORACLE-L

thanks Mercadante,
actually i have to use trim() function because the type of join.totid (varchar2(255) and type of cs.totid (char(255) are different.So when i compare those two values
my program can never find an equal value.I tried to change both of htem to char(8) , but i am having an error message saying that it can't be changed when the table is not empty. When i try to create new table with a totid of char(8), then i ama having "two large data " error message. Any idea how to avoid that?
cheers :)
----- Original Message -----
To: "Multiple recipients of list ORACLE-L" <ORACLE-L_at_fatcity.com> Sent: Wednesday, October 31, 2001 9:00 PM

> yilmaz,
>
> First of all, your query is probably performing a full table scan on each
> table because of your use of the TRIM function.
> Remove this.
>
> Secondly, why join the two tables together? Just query the table with the
> newer data in a loop, and update the older table like this:
>
> declare
> cursor c1 is
> select j.totid, j.source from join j where j.source is
not
> null;
> tot join.TOTID%type;--totid is the primary key for both
tables
> src cs.source%type;--source is the column to be updated
> begin
> open c1;
> loop
> fetch c1 into tot,src;
> exit when c1%notfound;
> update cs set source=src where totid=tot;
> end loop;
> commit;
> close c1;
> end;
>
> Hope this helps.
>
> Tom Mercadante
> Oracle Certified Professional
>
>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: yilmaz
  INET: yilmaz_at_hwajet.com.tw

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Cale, Rick T (Richard)
  INET: RICHARD.T.CALE_at_saic.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Oct 31 2001 - 09:15:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US