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: Scott Mattes <ScottMattes_at_yahoo.com>
Date: Fri, 22 Feb 2002 02:05:23 GMT
Message-ID: <DHhd8.8091$xs1.2611039@news1.news.adelphia.net>


No, I didn't catch that - I only read the posts whose subject line interests me.

Just put a to_number around the to_char and Oracle won't barf in the future.

"damorgan" <dan.morgan_at_ci.seattle.wa.us> wrote in message news:3C75902D.655E6E49_at_ci.seattle.wa.us...
> Did you also catch the fact that Oracle strongly advises people not to do
this.
> And that that fact has been posted repeatedly in this usenet group just
within
> the last two weeks?
>
> There is no guarantee it will always work. So don't do it.
>
> Daniel Morgan
>
>
>
>
> Scott Mattes wrote:
>
> > Sorry, can't catch me on that one, I actually ran it in SQL Plus before
> > posting. Here is the screen
> >
> > =====
> > SQL*Plus: Release 8.1.7.0.0 - Production on Thu Feb 21 17:52:04 2002
> >
> > (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
> > ---------
> > 23-FEB-02
> >
> > SQL>
> > =====
> >
> > 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 - 20:05:23 CST

Original text of this message

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