Your question is not clear.
At the time of Form only The Sequential Value will be displayed. I wrote this logic.
Where you are generating the sequence in the form?
After that opening that form The Empno will show 1009.
Where you are querying that block as you open the form? Whether it is showing all 10 records when you open the form?
Please post your ENTER-QUERY and EXECUTE-QUERY code.
My Code for generating Sequential Number is
PROCEDURE XXISC_EmpNo_Proc IS
SELECT MAX(Empno) INTO l_Empno
IF l_Empno IS NULL THEN
:XXISC_EMP_DETAILS_V.Empno := 999;
:XXISC_EMP_DETAILS_V.Empno := l_Empno + 1;
WHEN OTHERS THEN
You should definitely not use that approach for numbering your emp's. What happens if two users query your form at the same time? They will both get the same number and you will end up either with an error (if you defined a unique key on your EmpNo, or you have two employees with the same number.
Is there any reason why no use a sequence (ok, you may have gapos between the numbers, but you will have them anyway if you delete a record in between) ?
Also, please delete this exception-handler, is not only useless, it will even hide any real error which may happen in your code.
But By using Sequence, The Empno get's the Gaps. But my requirement is not getting any gaps between Empno.(Like The Empno has start from 999, 1000, 1001 .............)
Thanks & Regards,
Yes, it will contain gaps. Your options:
1. Discuss the requirement for gapless numbers with your customer, because in most cases there is no problems in having gaps (as already said, what happens if you delete a record in the database? You will also have gaps then).
2. Build your own logic to get a number without gaps, but to make it right you have to follow the steps discussed in your other thread.
3. Be sure to NOT use the max(Empno) in the way you posted here, as it is will cause problems in a multi-user-environment.