Home » Developer & Programmer » Forms » calculate (Windows XP Oracle Forms 6i,)
calculate [message #319440] Sun, 11 May 2008 05:52 Go to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
i have three fields one is

1) contract date
2) expiry date
3) Duration ( display field )

i wanna to calculate contract date and expiry date into the duration.

Example:
contract date 01/01/2007
expiry date 01/01/2008
it will display in duration ( 1 Year ) and if it is in month it will display 8 months blah blah blah.

any guidence please?

Regards

Re: calculate [message #319451 is a reply to message #319440] Sun, 11 May 2008 09:05 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
"Duration" is a difference between these two dates. It is calculated by subtraction, such as
SQL> select to_date('11.05.2008', 'dd.mm.yyyy')
  2       - to_date('20.09.2005', 'dd.mm.yyyy') result
  3  from dual;

    RESULT
----------
       964

SQL>
The result is number of DAYS. If you want a different format (for example, years/months/days etc.), you'll have to calculate it. There've been such question before on the OraFAQ Forum, so - use the Search facility.
Re: calculate [message #319452 is a reply to message #319451] Sun, 11 May 2008 09:27 Go to previous messageGo to next message
*munnabhai*
Messages: 157
Registered: March 2008
Location: Riyadh
Senior Member
Hi little,

Thanks for reply..

sorry to say you already i perform the below your query it give me days i wanna this 2007 to 2008 it should display 1 year if 2009 it should display 2 years....in Duration field.

any guidence in this please?

Regards

Re: calculate [message #319484 is a reply to message #319452] Sun, 11 May 2008 20:14 Go to previous message
wency
Messages: 450
Registered: April 2006
Location: Philippines
Senior Member

here's some links from simple search.

http://www.dbasupport.com/forums/archive/index.php/t-8520.html
http://www.geekinterview.com/question_details/3606

do some programming to solve the problem.
Previous Topic: How to know if my LOV is empty or not???
Next Topic: dyamic alert ?
Goto Forum:
  


Current Time: Sun Feb 09 05:59:42 CST 2025