Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Need to calculate week ending.
Sorry, can't catch me on that one, I actually ran it in SQL Plus before
posting. Here is the screen
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.2.0 - Production
With the Partitioning option
JServer Release 8.1.7.2.0 - Production
SQL> select sysdate - to_char( sysdate, 'd' ) + 7 from dual;
SYSDATE-T
Oracle and their 'oh, you must mean you wanted a number and not a character'
way of thinking.
"damorgan" <dan.morgan_at_ci.seattle.wa.us> wrote in message
news:3C756478.C271AE9C_at_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 - 16:54:11 CST