5 Replies Latest reply on Jul 16, 2013 2:39 PM by Andreas Weiden

    How to display text at the time of Retrieval?

    1007980

      Hi,

      I have Requirement like wise.

      Empno Contains the Sequental Number (Start from 999 to 9999). At the time of Form only The Sequential Value will be displayed. I wrote this logic. I got that requirement. I inserted 10 Records. After that opening that form  The Empno will show 1009. Now I am executing the ENter Query and executing the 1005th Empno Details. I got all the details of 1005th Empno details. But the Empno shows 1009. How to resolve this value.

       

       

       

      --

      Thanks & Regards,

      Hari Babu

        • 1. Re: How to display text at the time of Retrieval?
          Pramod SR

          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.

           

          Thanks,

          Pramod SR

          • 2. Re: How to display text at the time of Retrieval?
            1007980

            Hi Pramod,

            My Code for generating Sequential Number is

             

            PROCEDURE XXISC_EmpNo_Proc IS

              l_Empno NUMBER;

            BEGIN

             

              SELECT MAX(Empno) INTO l_Empno

              FROM XXISC_EMP_DETAILS_V;

             

              IF l_Empno IS NULL THEN

               :XXISC_EMP_DETAILS_V.Empno := 999;

              ELSE

               :XXISC_EMP_DETAILS_V.Empno := l_Empno + 1;

              END IF;

             

             

              EXCEPTION

              WHEN OTHERS THEN

              NULL;

             

            END;

            • 3. Re: How to display text at the time of Retrieval?
              Andreas Weiden

              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.

              • 4. Re: How to display text at the time of Retrieval?
                1007980

                Hi AndreasWeiden,

                 

                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,

                Hari Babu

                • 5. Re: How to display text at the time of Retrieval?
                  Andreas Weiden

                  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.