Thanks for the question, krishna.
Asked: October 11, 2016 - 2:27 pm UTC
Last updated: October 11, 2016 - 3:18 pm UTC
Version: 12.0.0.1
Viewed 1000+ times
create table t ( x varchar2(10) ); declare arr dbms_sql.varchar2a; dml_errors exception; pragma exception_init(dml_errors, -24381); begin arr(1) := 'a'; arr(2) := 'bbbbbbbbbbbb'; arr(3) := 'c'; forall i in 1 .. arr.count save exceptions insert into t values (arr(i)); exception when dml_errors then for i in 1 .. sql%bulk_exceptions.count loop dbms_output.put_line('Error: ' || arr(sql%bulk_exceptions(i).error_index)); end loop; end; / Error: bbbbbbbbbbbb
Rajeshwaran Jeyabal, October 12, 2016 - 10:28 am UTC
demo@ORA12C> create table t(x varchar2(10)); Table created. demo@ORA12C> exec dbms_errlog.create_error_log('T'); PL/SQL procedure successfully completed. demo@ORA12C> declare 2 l_array sys.odcivarchar2list := sys.odcivarchar2list(); 3 begin 4 l_array.extend(3); 5 l_array(1) := 'a'; 6 l_array(3) := 'c'; 7 l_array(2) := 'bbbbbbbbbbbb'; 8 insert into t(x) 9 select column_value from table(l_array) 10 log errors into err$_T reject limit unlimited; 11 end; 12 / PL/SQL procedure successfully completed. demo@ORA12C> select * from t; X ---------- a c 2 rows selected. demo@ORA12C> @printtbl "select * from err$_t" ORA_ERR_NUMBER$ : "12899" ORA_ERR_MESG$ : "ORA-12899: value too large for column "DEMO"."T"."X" (actual: 12, maximum: 10) " ORA_ERR_ROWID$ : "" ORA_ERR_OPTYP$ : "I" ORA_ERR_TAG$ : "" X : "bbbbbbbbbbbb" ----------------- PL/SQL procedure successfully completed. demo@ORA12C>
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library