Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Need to calculate week ending.

Re: Need to calculate week ending.

From: damorgan <dan.morgan_at_ci.seattle.wa.us>
Date: Thu, 21 Feb 2002 21:19:32 GMT
Message-ID: <3C756478.C271AE9C@ci.seattle.wa.us>


You can not subtract a CHAR from a date. But can, however subtract a date from a date and the result will be an number corresponding to the number of days in-between. You will need to use TRUNC to trim off the hours, minutes, and seconds so that the value returned is an integer:

For example:
SELECT TRUNC(SYSDATE) - TO_DATE('01-JAN-2002') FROM dual;

Also take a look at: http://technet.oracle.com/doc/server.815/a67779/ch2.htm

Daniel Morgan

Scott Mattes wrote:

> maybe something along this line
>
> select sysdate - to_char( sysdate, 'd' ) + 7 from dual;
>
> "Craig Lehn" <clehn_at_consystint.com> wrote in message
> news:3c74e6fc$1_8_at_goliath.newsgroups.com...
> > How do you calculate weekending using an insert into "table" select blah
> > query? Currently afterwards I use a cursor and an update query after the
> > fact to insert all the data into the table. this takes however a minute or
> > so. Any way to calculate weekending on the insert?
> >
> >
> >
> >
> > -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
> > http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
> > Check out our new Unlimited Server. No Download or Time Limits!
> > -----== Over 80,000 Newsgroups - 19 Different Servers! ==-----
Received on Thu Feb 21 2002 - 15:19:32 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US