Hi there any way to capture the objects (such as table and column) where an exception was thrown in ORACLE?
I need to determine the object name to customize the error message showing the user the name of the table and field where the exception occurred.
I know there is a variable SQLCODE and SQLERRM, but I wonder if there is any additional variable or a function that returns me the name of the error object.
i want something like this
exception
when others then
begin
if SQLCODE = -20010
then dbms_output.put_line('The Value Too Large in the field ' || GetObjectNameError);
end if;
end;
UPDATE
using the tony example
CREATE TABLE t (v varchar2(3));
COMMENT ON TABLE t IS 'my table description';
COMMENT ON COLUMN t.v IS 'my column description';
insert into t values ('xxxx');
Actually raise this error *
ERROR at line 1:
ORA-12899: value too large for column "MYSCHEMA"."T"."V" (actual: 4, maximum: 3)
I want to show something like this
ORA-12899: value too large for column "my column description" in table "my table description" (actual: 4, maximum: 3)
thanks in advance.