Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a SQL INSERT fail without raising an exception in PL/SQL

Are there any cases where an INSERT in SQL (specifically Oracle-PL/SQL) can fail without an exception being thrown? I'm seeing checks in code after INSERT where it verifies that SQL%ROWCOUNT = 1 ELSE it raises its own user-defined exception. I don't see how that can ever happen.

like image 329
aw crud Avatar asked Sep 04 '26 03:09

aw crud


1 Answers

It can't fail without an exception, no. Probably the developer who wrote the code didn't know that.

An after statement trigger could conceivably delete the row just inserted. And of course an INSERT...SELECT might find no rows to insert, and so would result in SQL%ROWCOUNT = 0.

like image 68
Tony Andrews Avatar answered Sep 05 '26 18:09

Tony Andrews



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!