Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number of Records in Insert Statement (Oracle)

I'd like to report on the number of records inserted in an Oracle insert statement. I'm inserting from a statement, so I could run my select twice and a count, but I'd rather keep it all in a single statement. Is there a way?

like image 772
Jeff Avatar asked Sep 23 '09 20:09

Jeff


People also ask

How does insert statement works in Oracle architecture?

The user executes a statement to insert a new row into a table. Oracle checks the user's privileges to make sure the user has the necessary rights to perform the insertion. If the user's privilege information isn't already in the library cache, it will have to be read from disk into that cache.

What is SQL Rowcount in Oracle?

%ROWCOUNT yields the number of rows affected by an INSERT, UPDATE, or DELETE statement, or returned by a SELECT INTO statement. %ROWCOUNT yields 0 if an INSERT, UPDATE, or DELETE statement affected no rows, or a SELECT INTO statement returned no rows.


1 Answers

Doing an INSERT in PL/SQL SQL%ROWCOUNT gives the number of inserted rows.

Doing an INSERT in C# cmd.ExecuteNonQuery() returns the number of inserted rows.

like image 127
Christian13467 Avatar answered Sep 20 '22 19:09

Christian13467