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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Problems with PL/SQL

Re: Problems with PL/SQL

From: Mark D Powell <mark.powellNOmaSPAM_at_eds.com.invalid>
Date: Tue, 15 Aug 2000 13:03:59 -0700
Message-ID: <009ed888.f756c59e@usw-ex0102-015.remarq.com>

Mark D Powell <mark.powellNOmaSPAM_at_eds.com.invalid> wrote:
>"Andrei Romazanov" <romazanov.andrei_at_gfos.de> wrote:
>>Hi,
>>
>>what NG can help me by common ORACLE PL/SQL-Problems? For
 example I want to
>>insert from a large table with commit after 1000 records. My
 first idea
>>wasn't correct :-(
>>
>>declare
>>a integer;
>>b integer;
>>begin
>>b:=10;
>>for a in 1..1000 loop
>>INSERT INTO table_dest SELECT * FROM table_source WHERE rownum
 between b
>>and b + 1000;
>>commit;
>>b:=b+1000;
>>end loop;
>>end;
>>/
>>
>>Thanks
>>
>>Andrei
>>
>Change the select into a cursor:
>declare
>v_count := v_count + 1 ;
>cursor c_source is
> select * from source_table ;
>begin
>open c_source ;
>loop
> fetch c_source into .....
> exit when c_source%notfound ;
> v_counter := v_counter + 1 ;
> if mod(v_counter,1000) = 0 then commit ;
>end loop ;
>close c_source ;
>end ;
>/
>This is live typing so beware of typo's.
>
>-- Mark D. Powell -- The only advice that counts is the advice
 that
>you follow so follow your own advice. --
>
>-----------------------------------------------------------
>

Woops! Forgot to include the insert, but since 4 other posts that are similiar to mine have showed up I think this one is covered.

Got questions? Get answers over the phone at Keen.com. Up to 100 minutes free!
http://www.keen.com Received on Tue Aug 15 2000 - 15:03:59 CDT

Original text of this message

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