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

Home -> Community -> Usenet -> c.d.o.server -> Re: Write No Package State

Re: Write No Package State

From: Michael Rothwell <michael_rothwell_at_non-hp-usa-om46.om.hp.com>
Date: Thu, 22 Oct 1998 10:14:33 -0700
Message-ID: <362F67F9.584A0821@non-hp-usa-om46.om.hp.com>


OK, here is the function:

function today( dCurDate in date ) return number is   nCurDay number default 0;
begin
  if valid( dCurDate ) = 'YES' then
    nCurDay := to_number( to_char( dCurDate, 'DD' ) ) - ( holidays( dCurDate ) + weekends( dCurDate ) );   end if;
  return nCurDay;
end; -- today

select workday.today( sysdate ) from dual;  

WORKDAY.TO


        16
1 row selected.

select 'test' from dual
 where workday.today( sysdate ) = 16  

 where workday.today( sysdate ) = 16

       *
ORA-06573: Function TODAY modifies package state, cannot be used here

Thomas Kyte wrote:
>
> A copy of this was sent to Michael Rothwell
> <michael_rothwell_at_non-hp-usa-om46.om.hp.com>
> (if that email address didn't require changing)
> On Tue, 20 Oct 1998 11:46:28 -0700, you wrote:
>
> >I have a package that contains some simple functions
> >regarding holidays, current workday, etc... Each of these
> >functions have an associated PRAGMA of "wnds".
> >
> >One function - "today" returns the current workday of the
> >month ( integer ). When I call the function as part of the
> >select clause in a statement - all works well. If I try to
> >use the function in the WHERE clause of a statement I get
> >the following error:
> >
> >ORA-06573: Function TODAY modifies package state, cannot be
> >used here
> >
> >If I include the "wnps" PRAGMA in the function, then I get
> >the following compile error:
> >
> >PLS-00452: Subprogram 'TODAY' violates its associated
> >pragma
> >
> >I dont understand why I am getting these errors. How am I
> >modifying the package state?
> >
> >Michael
>
> How about posting the package?
>
> Thomas Kyte
> tkyte_at_us.oracle.com
> Oracle Government
> Herndon VA
>
> --
> http://govt.us.oracle.com/ -- downloadable utilities
>
> ----------------------------------------------------------------------------
> Opinions are mine and do not necessarily reflect those of Oracle Corporation
>
> Anti-Anti Spam Msg: if you want an answer emailed to you,
> you have to make it easy to get email to you. Any bounced
> email will be treated the same way i treat SPAM-- I delete it.
Received on Thu Oct 22 1998 - 12:14:33 CDT

Original text of this message

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