Home » Developer & Programmer » Forms » ceiling (oracle 10g d2k 9i)
ceiling [message #503555] Mon, 18 April 2011 01:22 Go to next message
lacchhii
Messages: 151
Registered: May 2009
Location: bangalore
Senior Member

Hi,

I use oracle 10g with front end as D2k 9i. We maintain the pension of the government staff. Each pensioners gets monthly pension and a lumpsum amount as gratuity after retirement / death.

While calculating Gratuity any amount withheld due to specific reason will be reduced and final amount authorised.

the calculation for gratuity is mentioned below

L_BAL_GRTY:=NVL(L_DCRG_AMT,:APB_DCRG_AMT)-NVL(:APB_PAID_UPTILL,0);

:ADW.ADW_AMT := CEIL(L_BAL_GRTY*(:ADW.ADW_PERCENT/100));


Here i have one problem. the amount to be withheld is calculated as 10% of the actual gratuity amount subject to a maximum of Rs.10000/-.

While the above code calculates 10% of the Gratuity amount but does not restrict it to Rs.10000/-.

What changes should i have to do to the above code to restrict it to the maximum limit.

Thanks in advance
Re: ceiling [message #503580 is a reply to message #503555] Mon, 18 April 2011 03:06 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
SQL> SELECT LEAST(10000, 239111) FROM dual;

LEAST(10000,239111)
-------------------
              10000

SQL> 
Re: ceiling [message #503584 is a reply to message #503580] Mon, 18 April 2011 03:16 Go to previous messageGo to next message
lacchhii
Messages: 151
Registered: May 2009
Location: bangalore
Senior Member

thanks for the reply.

sorry, i am not very much familiar with the coding in oracle.

i require to modify the code written here

:ADW.ADW_AMT := CEIL(L_BAL_GRTY*(:ADW.ADW_PERCENT/100));

this gives the actual amount without limiting it to 10000/-. Suppose if the GRatuity amount is 150000, then the with held amount should be 150000*10% =15000, restricted to 10000/-. it should restrict the ADW_AMT to 10000/- instead of 15000/-, but if it is less than 10000/- , then the actual amount should be entered.

How do i use the least condition as you had mentioned in the above code.

sorry for the trouble.

thanks once again
Re: ceiling [message #503589 is a reply to message #503584] Mon, 18 April 2011 03:29 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Least takes two values, one would be 10000, the other would be the current calculation.
You really can work this one out.
Re: ceiling [message #503590 is a reply to message #503584] Mon, 18 April 2011 03:30 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Doesn't cookiemonster show you that LEAST limit to 10000?
You will get more familiar with the following page: LEAST.

Regards
Michel
Re: ceiling [message #503669 is a reply to message #503589] Mon, 18 April 2011 23:03 Go to previous message
lacchhii
Messages: 151
Registered: May 2009
Location: bangalore
Senior Member

hi,

sorry for not reading it properly. thanks a lot. it helped me solve the problem
Previous Topic: how to make browse image in oracle form 10g?
Next Topic: How to Know Operating System Current Path in oracle 10g forms ?
Goto Forum:
  


Current Time: Mon Sep 16 13:05:56 CDT 2024