pl/sql using cursors.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sai124
    New Member
    • Oct 2007
    • 14

    pl/sql using cursors.

    hi
    here is my pl/sql question.
    WE HAVE INCREASE THE SALARY OF EMPLOYEES WHOSE RATING IS BETWEEN 1 AND 5 BY 0.05.WHENEVER SUCH A RAISE IT SHOULD MAINTAINED IN A sal_raise TABLE.THAT sal_raiseTABLE CONSISTS OF
    SAILORS ID,DATE WHEN THE RAISE WAS GIVEN AND THE AMOUNT. the updation should be made in salary table. using cursors. the updation record should also kept in sal_raise table.

    the salary table has sid,month,basic salary,da(16%), hra(5%),lic(2%) ,epf(2%),gross and net.sailors table has rating ,name ,sid.

    i tried a lot but.. it is not pls help me......
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Originally posted by sai124
    hi
    here is my pl/sql question.
    WE HAVE INCREASE THE SALARY OF EMPLOYEES WHOSE RATING IS BETWEEN 1 AND 5 BY 0.05.WHENEVER SUCH A RAISE IT SHOULD MAINTAINED IN A sal_raise TABLE.THAT sal_raiseTABLE CONSISTS OF
    SAILORS ID,DATE WHEN THE RAISE WAS GIVEN AND THE AMOUNT. the updation should be made in salary table. using cursors. the updation record should also kept in sal_raise table.

    the salary table has sid,month,basic salary,da(16%), hra(5%),lic(2%) ,epf(2%),gross and net.sailors table has rating ,name ,sid.

    i tried a lot but.. it is not pls help me......

    Create an AFTER UPDATE TRIGGER ON employees table, When ever the salary is updated in employee table, then insert the empid,new amount and date into sal_raise table.

    Comment

    • sai124
      New Member
      • Oct 2007
      • 14

      #3
      Originally posted by amitpatel66
      Create an AFTER UPDATE TRIGGER ON employees table, When ever the salary is updated in employee table, then insert the empid,new amount and date into sal_raise table.
      is it necessary to update hra,da,lic...et c or else its enough with basic?

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #4
        Originally posted by sai124
        is it necessary to update hra,da,lic...et c or else its enough with basic?
        Well you have the salary categorized as HRA,BASIC,LTA etc....you need to update all the values by 0.05 only then the TOTAL GROSS will go up by 0.05%

        Comment

        • sai124
          New Member
          • Oct 2007
          • 14

          #5
          Originally posted by amitpatel66
          Well you have the salary categorized as HRA,BASIC,LTA etc....you need to update all the values by 0.05 only then the TOTAL GROSS will go up by 0.05%


          i updated.but when i add da,hra for gross it is showing an error that it has large precision . although i take round it is showing same error

          Comment

          • amitpatel66
            Recognized Expert Top Contributor
            • Mar 2007
            • 2358

            #6
            Originally posted by sai124
            i updated.but when i add da,hra for gross it is showing an error that it has large precision . although i take round it is showing same error
            Please POST your table structure for my reference. Then i could help you in better way.

            Comment

            • sai124
              New Member
              • Oct 2007
              • 14

              #7
              Originally posted by amitpatel66
              Please POST your table structure for my reference. Then i could help you in better way.


              TABLE OF SALARY:
              *************** *********

              SID | MONTH | BASIC | DA(16%) | HRA(5%) | LIC(2%) | EPF(2%)|GROSS| NET
              -----------------------------------------------------------------------------------------------------------------
              22 DEC 4000 640 200 80 80 4840 3860

              Comment

              • Saii
                Recognized Expert New Member
                • Apr 2007
                • 145

                #8
                Well, I guess that whenever there is salary raise, the basic is raised as per the rule and all the other dependent components are recalculated.

                Firstly, you need a procedure that calculates all dependent components(hra, da...) based on sal raise. You already know the rules for that (basic salary,da(16%), hra(5%),lic(2%) ,epf(2%))

                Then when rating changes for an employee, the salary and sal raise tables need to be updated( By any method(triggers or procedures)).

                Comment

                • amitpatel66
                  Recognized Expert Top Contributor
                  • Mar 2007
                  • 2358

                  #9
                  Originally posted by sai124
                  i updated.but when i add da,hra for gross it is showing an error that it has large precision . although i take round it is showing same error
                  I think column GROSS is not able to hold the value even after round off.

                  Please POST your trigger and table structure (column names <data types>) here!!

                  Comment

                  Working...