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 -> How can I receive number of rows inserted in PL/SQL?

How can I receive number of rows inserted in PL/SQL?

From: Christian Haberbosch <haberbosch_at_web.de>
Date: Mon, 23 Jun 2003 08:54:11 +0000 (UTC)
Message-ID: <2d2929da97a69b432035d8daa5025eb2.30428@mygate.mailgate.org>


How do I retrieve the number of rows inserted in PLSQL?

When I Am executing an INSERT command via SQLPLUS, then I get a message like:
SQL> x rows created in y seconds.

Probably an easy question, but I cannot find it in the documentation. Thanks in advance for your comments,
Christian.

Example:

SQL> create table t1 ( id number );
SQL> create table t2 ( id number );
SQL> INSERT INTO insert into t1 values ( 1 );
SQL> INSERT INTO insert into t1 values ( 2 );
SQL> INSERT INTO insert into t1 values ( 3 );

Now, I want to copy the records from t1 to t2, and I am interested in the number of records copied. (But I do not want to make a second SQL statement like "select count(*) from t1")

In SQL it is easy. Just
SQL> insert into t2(id) select id from t1; SQL> 3 rows created in 0 seconds.

and I know, that 3 records have been inserted.

How can I do this in PLSQL?

I want to have a function like:
-- the function p1 copies all records from t1 to t2

--

Posted via Mailgate.ORG Server - http://www.Mailgate.ORG Received on Mon Jun 23 2003 - 03:54:11 CDT

Original text of this message

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