I want to create an insert trigger, which puts data into a main table instead of a view - but only when data is valid. When data is not valid, I want the user to get a message telling him, that the data is not valid and is not inserted into main table:
create trigger validate_input instead of insert on main_view for each row
if length(column1) > length(column2) then
"SHOW MESSAGE: Your data is not valid - data is not inserted"
insert into main_table (column1, column2) values (:new.column1, :new.column2);
I was looking at something like
raise_application_error ('Your data is not valid - data is not inserted');
at the SHOW MESSAGE part, it worked, but got some other errors, like
insert into main_view (column1,column2) values ('ABCDEF','ABC')
Error at line 2
ORA-20001: 'Your data is not valid - data is not inserted
ORA-06512: at "VALIDATE_INPUT", line 4
ORA-04088: error during execution of trigger 'VALIDATE_INPUT'