Home » SQL & PL/SQL » SQL & PL/SQL » pl/sql date format (oracle 10g)
pl/sql date format [message #596494] Mon, 23 September 2013 23:45 Go to next message
vivek_veri
Messages: 8
Registered: September 2013
Location: INDIA
Junior Member
how to write pl/sql to create date o/p like .

since we wnat to design pl/sql report wich will generate monthwise sale from 01jan2009 to 01-sep-2013.
we have created funtion wich will accept argument as employee no, from date and to date.

from_date to_date
01-JAN-2009 01-FEB-2009
01-FEB-2009 01-MAR-2009
01-MAR-2009 01-APR-2009
01-APR-2009 01-MAY-2009
01-may-2009 01-JUN-2009
01-JUN-2009 01-JUL-2009

regards
viv
Re: pl/sql date format [message #596495 is a reply to message #596494] Mon, 23 September 2013 23:53 Go to previous messageGo to next message
BlackSwan
Messages: 22780
Registered: January 2009
Senior Member
http://www.orafaq.com/forum/mv/msg/95011/463394/102589/#msg_463394

enhance code in URL above
Re: pl/sql date format [message #596562 is a reply to message #596494] Tue, 24 September 2013 13:42 Go to previous messageGo to next message
EdStevens
Messages: 271
Registered: September 2013
Senior Member
So what is your question, exactly?
Dates should be stored in tables and handled in PL/SQL variables as datatype DATE. That is an internal, binary format that includes both date and time components. If you want to PRESENT them in a report in a particular format, you feed the DATE variable/column through the TO_CHAR function, specifying a format mask to format it however you like.

With a more precise question, we could provide a more precise answer.



[Edit MC: remove unnecessary full quote of OP's post]

[Updated on: Tue, 24 September 2013 13:49] by Moderator

Report message to a moderator

Re: pl/sql date format [message #596595 is a reply to message #596562] Wed, 25 September 2013 02:22 Go to previous messageGo to next message
vivek_veri
Messages: 8
Registered: September 2013
Location: INDIA
Junior Member
thanks blackswan . i have implemented that monthwise, yearwise and weekwise quiers in my report. it helped lot

if we want hourwise details of current day. for examp. todays date is 25sep2013.

from date to_date
25-sep-2013 00:00:00 25-sep-2013 01:00:00
25-sep-2013 01:00:00 25-sep-2013 02:00:00
25-sep-2013 02:00:00 25-sep-2013 03:00:00
25-sep-2013 03:00:00 25-sep-2013 04:00:00
25-sep-2013 04:00:00 25-sep-2013 05:00:00







[Updated on: Wed, 25 September 2013 02:23]

Report message to a moderator

Re: pl/sql date format [message #596602 is a reply to message #596595] Wed, 25 September 2013 02:48 Go to previous message
pablolee
Messages: 2617
Registered: May 2007
Location: Scotland
Senior Member
An hour is 1/24 of a day. You should be able to extrapolate from that.
Previous Topic: Increment sequnce no based on calender date.
Next Topic: using a cursor to fetch data
Goto Forum:
  


Current Time: Tue Sep 16 06:29:06 CDT 2014

Total time taken to generate the page: 0.10108 seconds