Home » Other » Training & Certification » days between last month (pl/sql)
days between last month [message #322153] Thu, 22 May 2008 11:28 Go to next message
lyren
Messages: 3
Registered: May 2008
Junior Member
Hi,
SYSDAET is '23-may-08'.
I want the result as
.... between '01-apr-08' and '30-apr-08'.
thanks
Re: days between last month [message #322154 is a reply to message #322153] Thu, 22 May 2008 11:30 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above

With Oracle characters between single quote marks are STRINGS

'this is a string, 2008-0522, not a date'

When you want DATE data type use TO_DATE function.

[Updated on: Thu, 22 May 2008 11:31] by Moderator

Report message to a moderator

Re: days between last month [message #322156 is a reply to message #322154] Thu, 22 May 2008 11:46 Go to previous messageGo to next message
lyren
Messages: 3
Registered: May 2008
Junior Member
thanks for that!
i think i didn't make that clear.
here is the thing:
the query is to display the property those has been sold
in the last month.
so i need to check the purchase_date of the property.
i don't know how write the statement for that.
something like
select property_id
from property
where purchase_date between ... and ....

do u know how to write that query?
thanks agagin.
Re: days between last month [message #322162 is a reply to message #322156] Thu, 22 May 2008 12:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Have a look at ADD_MONTHS, TRUNC and LAST_DAY functions.

Regards
Michel
Re: days between last month [message #322174 is a reply to message #322162] Thu, 22 May 2008 12:38 Go to previous message
lyren
Messages: 3
Registered: May 2008
Junior Member
okay,
i'll try
thanks!
Previous Topic: pl/sql program to copy
Next Topic: pl/sql book
Goto Forum:
  


Current Time: Thu Mar 28 11:03:31 CDT 2024