How to check for unique field constarint while updating the form
I have to check uniqueness on 2 database fields(x,y)
combination of x, y is unique which should be controlled in front end.
In preupdate and preinsert
iam using sql statement
select count(*) into v_count
from table
where x = 'value'
and y = 'value'
If v_count > 0 then
message('already exists');
raise form trigger failure;
end if
I am trying to update one of the fields in the block .
While committing the form it is giving the message(already exists)from the select query in preupdate.
Is there any way to stop the form other than
on error where error code= 40508 or 40509
then use the above sql stmt.
If count > 0 then
alerting the user(' already exists');
End if;