Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Retrieving counts from an insert operation

271736Jun 21 2007 — edited Jun 22 2007
Hello,

I'm using SQL to do an insert (it needs to be done in SQL) and I want to get the count of the records inserted:

INSERT INTO target
(LINK,
ENGLISHNAME,
FRENCHNAME, ...
)
SELECT
a.LINK,
a.ENGLISHNAME,
a.FRENCHNAME, ...
FROM
source a,
target b
WHERE
(
(a.LINK = b.LINK(+))
AND (a.LINK IS NOT NULL)
AND (b.LINK(+) IS NULL)
);

Sql*plus will show the records inserted;

66 rows inserted

But I need to capture this count for a logging table that I've created.

Is there a simple way to do this? Right now I run the select statement twice, once to get the count and then the second time to do the insert...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2007
Added on Jun 21 2007
20 comments
3,597 views