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

Home -> Community -> Usenet -> c.d.o.server -> Increment at counter

Increment at counter

From: Allan Martin <allan.martin_at_saic.com>
Date: Wed, 24 Oct 2001 17:01:48 +0100
Message-ID: <3bd6837c@cpns1.saic.com>


Hi,
I'm trying to insert into a number variable the amount of records that I insert into a table. ie. I want to increment the counter by 1 every time a row is inserted. I'd then display the amount at the end.

I have tried this over and over again and have even bought a book from AMAZON to help me in the future.

Does anyone know what to do as my book will take more that 20 days to arrive from
America?

I've got what I had in mind below.

Thanks a lot,
Allan

DECLARE     v_counter NUMBER := 0;

BEGIN  insert into tbl1

        (v1,
         v2,
         v3)
  select distinct
         v1,
         v2,
         v3
--        v_counter = v_counter + 1;

  from theTable;

  commit;

  dbms_output.put_line('1. || v_counter || ' records inserted.');

END;
/ Received on Wed Oct 24 2001 - 11:01:48 CDT

Original text of this message

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