Home » Developer & Programmer » Forms » Date Initial Value
Date Initial Value [message #451075] Mon, 12 April 2010 05:45 Go to next message
nemises42
Messages: 2
Registered: April 2010
Junior Member
Hi,
I have a two date fields in my form; valid from date and expiry date.

Currently my valid from date has an inital value property of $$date$$ which automaitcally brings up todays date.

I need my expiry date to automatically show a date 15 years after this date? Can anyone help?

Thanks in advance.
Re: Date Initial Value [message #451085 is a reply to message #451075] Mon, 12 April 2010 06:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68686
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
http://www.orafaq.com/forum/t/156656/102589/

Regards
Michel
Re: Date Initial Value [message #451089 is a reply to message #451075] Mon, 12 April 2010 07:00 Go to previous messageGo to next message
sinida1984
Messages: 83
Registered: September 2007
Location: India
Member
select add_months(sysdate,(12*12)) from dual

Thanks
Sinida
Re: Date Initial Value [message #451090 is a reply to message #451075] Mon, 12 April 2010 07:06 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
That would be 12 years, not 15, and can you please use code tags.
Re: Date Initial Value [message #451093 is a reply to message #451075] Mon, 12 April 2010 07:16 Go to previous messageGo to next message
nemises42
Messages: 2
Registered: April 2010
Junior Member
Hi,

Sorry. Do you know exactly how it works.

Do I just simply type add_months(sysdate,1).
When i type this I get error (Encountered the symbol END).

Thanks
Re: Date Initial Value [message #451097 is a reply to message #451075] Mon, 12 April 2010 07:22 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
Add_months is a function, you need to tell oracle where to put the result.
Re: Date Initial Value [message #451353 is a reply to message #451093] Wed, 14 April 2010 02:51 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

David
Re: Date Initial Value [message #451378 is a reply to message #451093] Wed, 14 April 2010 04:36 Go to previous messageGo to next message
sinida1984
Messages: 83
Registered: September 2007
Location: India
Member
Hi

Please take the result into a variable.Add_months() is a date function. So the result should be stored in a variable.
Example...

declare
result_dt date;
begin
result_dt := add_months(sysdate,(15*12));
end;

Thanks
Sinida
Re: Date Initial Value [message #451382 is a reply to message #451378] Wed, 14 April 2010 04:47 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; only, as it is Forms and item's initial values we are talking about, your "variable" is, actually, an item.
:some_block.date_item := add_months(sysdate, 15 * 12);
TRUNC might also be needed (depending on requirements).
Previous Topic: Copy Rows from Excel Paste in Forms
Next Topic: FRM-40202: Field must be entered (after the "standard" form had been modified)
Goto Forum:
  


Current Time: Fri Sep 20 10:40:00 CDT 2024