prevent duplicate record entry date wise [message #526250] |
Mon, 10 October 2011 05:54 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/06b42bb1d9c7dd3931310cac212d7c22?s=64&d=mm&r=g) |
hissam78
Messages: 193 Registered: August 2011 Location: PAKISTAN
|
Senior Member |
|
|
we have a table attendance_d with no constraint which have duplicate emp_id we want to stop duplicate emp_id on the same date. if employee's record already entered in today's date then duplicate Error message must show if he tries again to enter the same record.
for this i have written the following code but it is not working date wise some body can help me. i want to use on WHEN VALIDATE ITEM TRIGGER in oracle forms 6i.
Code:
DECLARE
l_count NUMBER;
BEGIN
SELECT COUNT (*)
INTO l_count
FROM attendance_d
WHERE emp_id = :attendance_d.emp_id AND attendance_date = SYSDATE;
IF l_count > 0
THEN
MESSAGE ('Duplicate Value!');
MESSAGE (' ', no_acknowledge);
RAISE form_trigger_failure;
ELSE
NULL;
END IF;
END;
please help me.
Sorry dear all i have tried my best to format the syntax of code but in preview it showing like as above i have formated in toad by using the key ctrl+shift+f.
thanx
shafiq
|
|
|
|
|