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: functions in a package

Re: functions in a package

From: Andrew Allen <ajallen_at_mailhost.det.ameritech.net>
Date: Thu, 13 Feb 2003 06:02:10 GMT
Message-ID: <3E4B2672.33FB8CDA@mailhost.det.ameritech.net>


Dwayne wrote:
>
> I am having trouble putting a function in a package body
> the problem now lies in putting the function in the package body. I
> keep getting syntax errors.
>
> let me show you:
>
> CREATE OR REPLACE PACKAGE CAP
> IS
> FUNCTION LAST_CAP RETURN VARCHAR2;
> END;
> /
>
> Package created.
>
> 1 CREATE OR REPLACE PACKAGE BODY CAP
> 2 IS
> 3 FUNCTION LAST_CAP
> 4 (NAME VARCHAR2)
> 5 RETURN VARCHAR2
> 6 IS
> 7 BEGIN
> 8 RETURN LOWER(SUBSTR(NAME,1,LENGTH(NAME)-1))||UPPER(SUBSTR(NAME,-1));
> 9 END LAST_CAP;
> 10* end;
> SQL> /
>
> Warning: Package Body created with compilation errors.
>
> SQL> show error
> Errors for PACKAGE BODY CAP:
>
> LINE/COL ERROR
> -------- -----------------------------------------------------------------
> 3/10 PLS-00323: subprogram or cursor 'LAST_CAP' is declared in a
> package specification and must be defined in the package body
>
> I spent 3 hours on this trying different combos but nothing.

Try including the argument declared in the package body ( NAME VARCHAR2 ) in the package header.

-- 
Andrew Allen
Received on Thu Feb 13 2003 - 00:02:10 CST

Original text of this message

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