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: Ed Prochak <edprochak_at_gmail.com>
Date: 16 Jul 2006 06:18:47 -0700
Message-ID: <1153055926.988135.158650@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. Received on Sun Jul 16 2006 - 08:18:47 CDT

Original text of this message

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