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: this cannot be then best way

Re: this cannot be then best way

From: <g>
Date: Mon, 17 Jul 2006 11:45:16 +0100
Message-ID: <YYadnRC68fAe9ybZnZ2dnUVZ8qWdnZ2d@bt.com>

"Ed Prochak" <edprochak_at_gmail.com> wrote in message news:1153055926.988135.158650_at_h48g2000cwc.googlegroups.com...
>
> Vladimir M. Zakharychev wrote:
> > DA Morgan wrote:
> > > g wrote:
> > > > I have a date mydate and i want to subtract X working days off
> > > >
> > > > i was thinking of something like
> > > >
> > > > loop while x > 0
> > > > if to_char(mydate,'d') < 6 then
> > > > x = x -1
> > > > endif
> > > > mydate :mydate - 1
> > > > endloop
> > > >
> > > > any ideas
> > >
> > > Just a quick note: TO_CHAR does not produce a number and
> > > essentially none of the code, above, is valid. It will
> > > never run in Oracle. What product do you have?
> >
> > It will, as PL/SQL engine will implicitly apply TO_NUMBER() to the
> > result of TO_CHAR() in attempt to match types of the values being
> > compared. Not a good idea to rely on implicit type conversion though
> > (at least until 10g where it seems to be more efficient than explicit
> > conversion sometimes.)
> >
> > Regards,
> > Vladimir M. Zakharychev
>
> I took it as pseudocode as it will not work as written. Just look at
> the assignment statements.
>

Thanks all
it works a treat
  it always worth a second look to see if anyone else has a better idea Received on Mon Jul 17 2006 - 05:45:16 CDT

Original text of this message

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