Insert 语句中的记录数 (Oracle)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1468396/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 19:04:34  来源:igfitidea点击:

Number of Records in Insert Statement (Oracle)

oracleinsertnumbersrecords

提问by Jeff

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?

我想报告在 Oracle 插入语句中插入的记录数。我从一个语句插入,所以我可以运行我的选择两次和一个计数,但我宁愿将它全部保存在一个语句中。有办法吗?

回答by Christian13467

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

在 PL/SQL 中执行 INSERTSQL%ROWCOUNT会给出插入的行数。

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

在 C# 中执行 INSERTcmd.ExecuteNonQuery()返回插入的行数。