Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: bands - sql statement
Thats easy,
SELECT minutes,
decode(sign(minutes),-1,'number out of band',0,'number out of
band',TO_CHAR(FLOOR((minutes-1)/15)*15+1)||'-'||
TO_CHAR(FLOOR((minutes-1)/15 )*15+15)) band
FROM minutes_table
Bye
Uli
Cobra__77 <Cobra__77_at_hotmail.com> schrieb in im Newsbeitrag:
eiYV4.2677$sW4.15083_at_news-server.bigpond.net.au...
> For 0 and negative numbers I want to show "number out of band" or
something
> similar to this...
>
> regards
>
>
> "Ulrik Hoffmann" <ulrik_at_hoffmann-kiel.de##nospam> wrote in message
> news:8g9dtt$t5i3$1_at_fu-berlin.de...
> > Hi,
> >
> > tell me, what do you want to show if it is
> >
> > 0
> > -1
> > -20
> > -30
> >
> > Even it looks kind of funny, the display is not wrong, imho ;-)
> >
> > Bye
> > Uli
> >
> >
> > Cobra__77 <Cobra__77_at_hotmail.com> schrieb in im Newsbeitrag:
> > dfPV4.2328$sW4.12749_at_news-server.bigpond.net.au...
> > > Thanks for your response...
> > >
> > > it works perfect..except for the case where minute is zero or if it
is
> > > negative number...which may happen...
> > > do you have any ideas how to deal with this case?
> > >
> > > thanks
> > > coby
> > >
> > > "Ulrik Hoffmann" <ulrik_at_hoffmann-kiel.de##nospam> wrote in message
> > > news:8g8aec$qf05$1_at_fu-berlin.de...
> > > > Hi, what about
> > > >
> > > >
> > > > SELECT minutes,
> > > >
TO_CHAR(FLOOR((minutes-1)/15)*15+1)||'-'||TO_CHAR(FLOOR((minutes-1)/15
> > > > )*15+15) band
> > > > FROM minutes_table
> > > >
> > > > Hth,
> > > > Uli
> > > >
> > > > > I have a field in a table that has time in minutes as
integer...eg 1
, 2, 3
> > > > > no upper limit...and I want to convert this into 15 minutes
bands...eg 1 to
> > > > > 1-15 , 2 to 1-15 ....and 16 to 16-30 ... 17 to 16-30..... etc
etc
> > > > > so my bands are 1-15 , 16-30, 31-45 ..... no upper limit ...any
way
to do
> > > > > this conversion in sql?
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
>
Received on Mon May 22 2000 - 00:00:00 CDT
![]() |
![]() |