Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: date functions
SELECT...,week_num... FROM... WHERE...
The TO_CHAR with its associated syntax will return the week number of
your_date_field, and call it week_num.
You may want to use IW instead of WW. IW uses the ISO week number. Depends
on your need.
Generally, date arithmetic is pretty straightforward if you are retrieving the dates from a date data type. You do need to be concerned with the time value, however, as that is stored as part of the date, and any calculations will take the time into consideration as well, unless you usen TRUNC() or TO_CHAR() to exclude the time. Again, depends on what you need to do.
Any of this could be used in a stored procedure or function, but it's not necessary to do so. Plain old Oracle SQL can handle it easily.
<Jiri.Felcman_at_noofs.abb.no> wrote in message
news:810phn$iln$1_at_nnrp1.deja.com...
> Does anybody know what is the easiest way to be able to use special
> date/time functions (getweeknumber, daysbetween, isyearleap ...) in
> ORACLE SQL? For example - I have statistics data calculated every 30
> minutes and I want to create a view where all data will be grouped by
> week number.
>
> Is there any PL/SQL package or should a C(C++) component be used?
>
> Thanks and with regards
>
> Jiri
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Nov 18 1999 - 08:34:42 CST
![]() |
![]() |