can key-commit re-check the input value? [message #363038] |
Thu, 04 December 2008 22:12  |
kevin_ye
Messages: 37 Registered: December 2007 Location: Shanghai,China
|
Member |
|
|
There are empno, ename, job, sal and others information on form, and require:
(1) empno is not allowed null, and not duplicate
(2) ename is not allowed null.
I want to check the input value(even no input) valid or not before save, so I use serveral procedure to check in key-commit trigger. but there is a problem:
if empno is null first, and i click save button, it would pop-up a failure message; but after i input a valid value, then click the save button again, it still pop-up the failure message.
the value is valid, why key-commit trigger doesn't recall the procedure? if recall, let it pass, not pop-up the failure message again.
any suggestion will be appreciated.
------------------------------------------------------------
validate_emp_id_YN: validate empno
procedure validate_emp_id_YN IS
cursor cu_emp_count(in_emp_id varchar2) is
select count(*) from scott.emp
where empno=in_emp_id;
lv_count number;
begin
if :emp.empno is null then
message('empno error');
message('empno cannot null',acknowledge);
raise form_trigger_failure;
else
open cu_emp_count(:emp.empno);
fetch cu_emp_count into lv_count;
close cu_emp_count;
if (lv_count>0) then
message('empno error');
message('empno duplicate',acknowledge);
raise form_trigger_failure;
end if;
end if;
end;
validate_emp_id_YN: validate empno
procedure validate_emp_name_YN is
begin
if :emp.ename is null then
message('ename error');
message('ename cannot null',acknowledge);
raise form_trigger_failure;
end if;
end;
key-commit trigger:
validate_emp_id_YN;
validate_emp_name_YN;
-
Attachment: scott2.fmb
(Size: 52.00KB, Downloaded 1026 times)
|
|
|
|