Can SQL INSERT fail without throwing an exception in PL / SQL

Are there any cases where INSERTin SQL (in particular, Oracle-PL / SQL) an exception can end without exception? I see the checks in the code after INSERT, where it checks what SQL%ROWCOUNT = 1 ELSEcauses its own custom exception. I do not understand how this can happen.

+3
source share
3 answers

It cannot fail without exception, no. The developer who wrote the code probably did not know this.

The After after trigger may possibly delete the row just inserted. And, of course, INSERT ... SELECT may not find the rows to insert, and this will result in SQL% ROWCOUNT = 0.

+8
source

In addition to the problem based on the @mcabral trigger, you may have a successful insert, but insert more than one row. For example, the insert into blah(col1) select col2 from fooinsertion style .

+2
source

@TonyAndrews @GinoA, : INSERT , (, INSERT INTO tablename SELECT...).

, PL/SQL. , SQL%ROWCOUNT , COMMIT ROLLBACK.

, PL/SQL- .

EDIT: Someone needs to change the title of the question to indicate PL / SQL (as indicated in the question itself), since this is not the same as the SQL scope the name refers to.

+2
source

Source: https://habr.com/ru/post/1777771/


All Articles