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 -> pl/sql update problem

pl/sql update problem

From: Ralf Bender <ralf_bender_at_web.de>
Date: 11 Apr 2001 21:44:52 +0200
Message-ID: <3ad4b435$1@netnews.web.de>

hello

i want to update many records with pl/sql statement. KTO_NR_AUFTRG is a CHAR Field. I want to set all with trailing '0' until Field length = 10 and commit every 2000 records, because there too much records, so it will run into rbs error.  here is my statement, but it won't update anything:

declare
  i number := 0;
  cursor s1 is SELECT * FROM tbl_belege

  		 	   WHERE length(KTO_NR_AUFTRG) < 10
               FOR UPDATE;

begin

   for c1 in s1 loop

      update tbl_belege 
	  set KTO_NR_AUFTRG = ltrim(rtrim(to_char(to_number(c1.
KTO_NR_AUFTRG),'0999999999')))
	  where current of s1;
      i := i + 1;              -- Commit after every X records
      if i > 1000 then
         commit;
         i := 0;
      end if;


  end loop;
  commit;
end;
/

a select :
select ltrim(rtrim(to_char(to_number(KTO_NR_AUFTRG),'0999999999'))) from tbl_belege

will bring all what i want to have...

what's wrong???

thx

ralf

-- 
_____________________________________________________________
NewsGroups Suchen, lesen, schreiben mit http://netnews.web.de
Received on Wed Apr 11 2001 - 14:44:52 CDT

Original text of this message

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