Oracle 11g 記錄DML錯誤資料

來源:互聯網
上載者:User

標籤:limit   sch   第一個   str   from   ssi   cti   rac   who   

[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錯誤資料

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.