Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: PL/SQL Removing weekends

Re: PL/SQL Removing weekends

From: <helen267_at_my-deja.com>
Date: Thu, 12 Oct 2000 22:48:18 GMT
Message-ID: <8s5f3g$ack$1@nnrp1.deja.com>

Thank you - with a bit of modification to suit my table, it worked perfectly!

Helen

In article <gNjF5.44$cS1.8893_at_wdc-read-01.qwest.net>,   "Mike Dwyer" <dwyermj_at_co,larimer.co.us> wrote:
> declare
> vdate date;
> vdnum number;
> wkend number := 0;
> begin
> select adate into vdate
> from mikejunk where rownum = 1;
>
> s_output.put_line(
> 'Weekend days between ' ||
> to_char( vdate, 'mm/dd/yyyy') ||
> ' and ' ||
> to_char( sysdate, 'mm/dd/yyyy'));
> while vdate <= sysdate loop
> select to_char( vdate, 'd'),
> vdate+1
> into vdnum,
> vdate
> from dual;
> if vdnum = 1 or vdnum = 7 then
> wkend := wkend + 1;
> end if;
> end loop;
> dbms_output.put_line( ' is: ' || to_char( wkend));
> end;
> /
> adate is a date column = '30-SEP-00'.
>
> <helen267_at_my-deja.com> wrote in message news:8s0f5k$5s8
 $1_at_nnrp1.deja.com...
> > Hi there
> >
> > I'm trying to write a simple PL/SQL script (for a stored procedure)
> > that will count the number of weekend days, i.e Saturday and Sunday,
> > that occur between two dates. I thought I had it right, but I can't
> > for the life of me work out why it's not working!
> >
> > Has anyone done anything similar and could help me out, either by
> > checking the script I have so far, or writing a quick solution?
> >
> > Thanks in advance
> >
> > Helen
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Oct 12 2000 - 17:48:18 CDT

Original text of this message

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