创建 建表 expr nal blog eject tps exceptio
[From] https://oracle-base.com/articles/10g/dml-error-logging-10gr2
需要记录下大量 DML 操作中出错的具体 record,看到有两种方案,一种是使用批量 DML 操作 bulk collect 并带上 save exceptions 子句,然后做处理。稍微繁琐,不想使用。于是用另一种方案,就是在 DML 语句后面跟上 LOG ERRORS。
- LOG ERRORS[INTO[schema.] table][('simple_expression')][REJECT LIMIT integer | UNLIMITED]
- The optional INTO clause allows you to specify the name of the error logging table.If you omit this clause,
- the the first 25 characters of the base table name are used along with the "ERR$_"prefix.
- The simple_expression is used to specify a tag that makes the errors easier to identify.This might be a string or any
- function whose result is converted to a string.
- The REJECT LIMIT is used to specify the maximum number of errors before the statement fails.The
- default value is 0 and the maximum values is the keyword UNLIMITED.For parallel DML operations,
- the reject limit is applied to each parallel server.
其中,这个错误记录表需要先创建,可以使用包 exec DBMS_ERRLOG.CREATE_ERROR_LOG('target_table'); 来创建。第一个参数就是需要被记录 DML 操作的目标表。如果不附加参数,则默认会创建表名为 ERR&_target_table 的表。之后就可以使用 LOG ERRORS 了,使用默认表名时,log errors 后面可以不需要 into。
Oracle 11g 记录 DML 错误数据
来源: http://www.bubuko.com/infodetail-2163677.html