Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> package body invalidated
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C05307.9C858060
Content-Type: text/plain;
charset="iso-8859-1"
Package body of one of my application packages becomes invalid
intermittantly and I have no idea why.
Oracle 8.1.6.2 Sun Solaris 2.7
Anybody can suggest the possible cause for invalidation of package body of this package?
Create or Replace Package PRO_TEST.Pkg_Entity as
function cleanupEntityId(p_id in varchar2) return varchar2;
procedure validateEntityId(p_type in integer, p_id in varchar2);
function getEntityDisplay( p_type in integer, p_id in varchar2, p_onNotFound in varchar2 := NULL) returnvarchar2;
PRAGMA RESTRICT_REFERENCES(cleanupEntityId, RNDS, WNDS, WNPS, RNPS); PRAGMA RESTRICT_REFERENCES(getEntityDisplay, WNDS, WNPS, RNPS); PNAMESTYLE_SHORT constant integer := 0; PNAMESTYLE_SIMPLE constant integer := 1; PNAMESTYLE_COMPLETE constant integer := 2; PNAMESTYLE_SHORT_SORTABLE constant integer := 3; PNAMESTYLE_SORTABLE constant integer := 4; ADDRSTYLE_HTML constant integer := 0; function getPersonAge(p_birthDate in date) return varchar2; function createPersonName( p_style in integer, p_name_Prefix in varchar2, p_name_First in varchar2, p_name_Middle in varchar2, p_name_Last in varchar2, p_name_Suffix in varchar2) return varchar2; function createAddress( p_style in integer, p_line1 in varchar2, p_line2 in varchar2, p_city in varchar2, p_state in varchar2, p_zip in varchar2) return varchar2; PRAGMA RESTRICT_REFERENCES(getPersonAge, WNDS, WNPS, RNPS);
end Pkg_Entity;
Create or Replace Package Body PRO_TEST.Pkg_Entity as
function CleanupEntityId(p_id in varchar2) return varchar2 is begin if p_id is null then return null; else return upper(p_id); end if; end; procedure validateEntityId(p_type in integer, p_id in varchar2) is begin NULL; end; function getEntityDisplay(p_type in integer, p_id in varchar2, p_onNotFound in varchar2) return varchar2 is v_display varchar2(512) := NULL; begin if p_type = 0 then select SIMPLE_NAME into v_display from person where person_id = p_id; elsif p_type = 1 then select NAME_PRIMARY into v_display from org where org_internal_id = p_id; end if; if v_display is null then if p_onNotFound is not null then v_display := p_onNotFound; else v_display := '"' || p_id || '" (' || p_type || ') not found'; end if; end if; return v_display; end; function getPersonAge(p_birthDate in date) return varchar2 is v_ageMonths number; begin if p_birthDate is null then return null; else v_ageMonths := MONTHS_BETWEEN(SysDate, p_birthDate); if v_ageMonths > 12 then return to_char(trunc(v_ageMonths/12)); elsif v_ageMonths > 1 then return to_char(trunc(v_ageMonths)) || ' months'; elsif v_ageMonths = 1 then return to_char(trunc(v_ageMonths)) || ' month'; else return to_char(trunc(v_ageMonths * 30)) || ' days'; end if; end if; end; function createPersonName( p_style in integer, p_name_Prefix in varchar2, p_name_First in varchar2, p_name_Middle in varchar2, p_name_Last in varchar2, p_name_Suffix in varchar2) return varchar2 is v_namePrefix varchar2(32); v_nameMiddle varchar2(64); v_nameSuffix varchar2(32); begin if p_name_Prefix is NULL then v_namePrefix := ''; else v_namePrefix := p_name_Prefix || ' '; end if; if p_name_Middle is NULL then v_nameMiddle := ''; else v_nameMiddle := ' ' || p_name_Middle; end if; if p_name_Suffix is NULL then v_nameSuffix := ''; else v_nameSuffix := ' ' || p_name_Suffix; end if; if p_style = PNAMESTYLE_SHORT then return substr(p_name_first, 1, 1) || ' ' || p_name_Last; elsif p_style = PNAMESTYLE_SIMPLE then return p_name_First || v_nameMiddle || ' ' || p_name_Last || v_nameSuffix; elsif p_style = PNAMESTYLE_COMPLETE then return v_namePrefix || p_name_First || v_nameMiddle || ' ' || p_name_Last || v_nameSuffix; elsif p_style = PNAMESTYLE_SHORT_SORTABLE then return p_name_Last || ', ' || substr(p_name_first, 1, 1); else return p_name_Last || v_nameSuffix || ', ' || p_name_First || v_nameMiddle; end if; end; function createAddress( p_style in integer, p_line1 in varchar2, p_line2 in varchar2, p_city in varchar2, p_state in varchar2, p_zip in varchar2) return varchar2 is v_address varchar2(512); begin v_address := p_line1; if not(p_line2 is NULL) and (length(p_line2) > 0) then v_address := v_address || '<br>' || p_line2; end if; v_address := v_address || '<br>' || p_city || ', ' || p_state || ' ' || p_zip; return v_address; end;
end Pkg_Entity;
Alex Hillman
------_=_NextPart_001_01C05307.9C858060
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2448.0">
<TITLE>package body invalidated</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2 FACE=3D"Arial">Package body of one of my application =
packages becomes invalid intermittantly and I have no idea why.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Oracle 8.1.6.2 Sun Solaris =
2.7</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Anybody can suggest the possible cause =
for invalidation of package body of this package?</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Create or Replace Package =
PRO_TEST.Pkg_Entity as</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
cleanupEntityId(p_id in varchar2) return varchar2;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> procedure =
validateEntityId(p_type in integer, p_id in varchar2);</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
getEntityDisplay(</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; p_type in =integer,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_id in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_onNotFound =in varchar2 :=3D NULL) return varchar2;</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> PRAGMA =
RESTRICT_REFERENCES(cleanupEntityId, RNDS, WNDS, WNPS, RNPS);</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> PRAGMA =
RESTRICT_REFERENCES(getEntityDisplay, WNDS, WNPS, RNPS);</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> =
PNAMESTYLE_SHORT constant integer :=3D 0;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
PNAMESTYLE_SIMPLE constant integer :=3D 1;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
PNAMESTYLE_COMPLETE constant integer :=3D 2;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
PNAMESTYLE_SHORT_SORTABLE constant integer :=3D 3;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> =
PNAMESTYLE_SORTABLE constant integer :=3D 4;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> =
ADDRSTYLE_HTML constant integer :=3D 0;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
getPersonAge(p_birthDate in date) return varchar2;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
createPersonName(</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; p_style in =integer,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Prefix =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_First =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Middle =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Last =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Suffix =in varchar2) return varchar2;</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
createAddress(</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; p_style in =integer,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_line1 in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_line2 in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_city in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_state in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_zip in =varchar2) return varchar2;</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> PRAGMA =
RESTRICT_REFERENCES(getPersonAge, WNDS, WNPS, RNPS);</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">end Pkg_Entity;</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">Create or Replace Package Body =
PRO_TEST.Pkg_Entity as</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
CleanupEntityId(p_id in varchar2) return varchar2 is</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> begin</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; if p_id is null then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; return null;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; else</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; return upper(p_id);</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; end if;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> end;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> procedure =
validateEntityId(p_type in integer, p_id in varchar2) is</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> &n=
bsp; begin</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; NULL;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> end;</FONT>
</P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
getEntityDisplay(p_type in integer, p_id in varchar2, p_onNotFound in =
varchar2) return varchar2 is</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; v_display varchar2(512) :=3D =
NULL;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> begin</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; if p_type =3D 0 then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; select SIMPLE_NAME into v_display from person</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; where person_id =3D p_id;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; elsif p_type =3D 1 then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; select NAME_PRIMARY into v_display from org</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; where org_internal_id =3D p_id;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; end if;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; if v_display is null then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; if p_onNotFound is not null then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; v_display =:=3D p_onNotFound;</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; v_display =:=3D '"' || p_id || '" (' || p_type || ') not found';</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
getPersonAge(p_birthDate in date) return varchar2 is</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; v_ageMonths number;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> begin</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; if p_birthDate is null then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; return null;</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; else</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; v_ageMonths :=3D MONTHS_BETWEEN(SysDate, p_birthDate);</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; &nb=
sp; if v_ageMonths > 12 then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; return =to_char(trunc(v_ageMonths/12));</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; return =to_char(trunc(v_ageMonths)) || ' months';</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; return =to_char(trunc(v_ageMonths)) || ' month';</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; return =to_char(trunc(v_ageMonths * 30)) || ' days';</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
createPersonName(</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; p_style in =integer,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Prefix =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_First =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Middle =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Last =in varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_name_Suffix =in varchar2) return varchar2 is</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb=
sp; if p_style =3D PNAMESTYLE_SHORT =
then</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; return substr(p_name_first, 1, 1) || ' ' || p_name_Last;</FONT=>
FACE=3D"Arial"> &nb= sp; &nb= sp; return v_namePrefix || p_name_First || v_nameMiddle || ' ' || =p_name_Last || v_nameSuffix;</FONT>
sp; &nb= sp; return p_name_Last || ', ' || substr(p_name_first, 1, = 1);</FONT>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"> function =
createAddress(</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"> &nb= sp; &nb= sp; p_style in =integer,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_line1 in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_line2 in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_city in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_state in =varchar2,</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; p_zip in =varchar2) return varchar2 is</FONT>
FACE=3D"Arial"> &nb= sp; &nb= sp; v_address :=3D v_address || '<br>' || p_line2;</FONT>