The CREATE_ERROR_LOG procedure is used to create an error log table for a specified DML table.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support it.
Syntax
DBMS_ERRLOG.CREATE_ERROR_LOG(
dml_table_name IN VARCHAR2,
err_log_table_name IN VARCHAR2 DEFAULT NULL,
err_log_table_owner IN VARCHAR2 DEFAULT NULL,
err_log_table_space IN VARCHAR2 DEFAULT NULL,
skip_unsupported IN BOOLEAN DEFAULT FALSE);
Parameters
Parameter |
Description |
|---|---|
| dml_table_name | The name of the DML table for which you want to create an error log table. |
| err_log_table_name | The name of the error log table. If it isNULL, the default value is used.ERR$_Prefix with DML table name. |
| err_log_table_owner | The schema to which the error log table belongs. If it isNULL, to use the current schema. |
| err_log_table_space | The tablespace where the error log table is located. If it isNULL, which uses the default tablespace of the DML table. |
| skip_unsupported | Whether to skip unsupported column types. Default isFALSE. |
Usage instructions
Error log tables are used in conjunction with the DML error logging feature. When you add a LOG ERRORS clause to a DML statement, errors that occur during execution are recorded in the error log table without causing the entire transaction to roll back.
The error log table contains the following system columns:
ORA_ERR_NUMBER$: error numberORA_ERR_MESG$: error messageORA_ERR_ROWID$: row IDORA_ERR_OPTYP$: operation typeORA_ERR_TAG$: error tag- and the error record columns corresponding to each column in the original table
Examples
-- Create a test table
CREATE TABLE employees (
emp_id NUMBER PRIMARY KEY,
emp_name VARCHAR2(50),
salary NUMBER
);
-- Create an error log table named ERR$_employees.
BEGIN
DBMS_ERRLOG.CREATE_ERROR_LOG(
dml_table_name => 'employees');
END;
/
-- Insert data using the LOG ERRORS clause
INSERT INTO employees (emp_id, emp_name, salary)
VALUES (1, 'Alice', 5000)
LOG ERRORS REJECT LIMIT UNLIMITED;
