user1
user1

Reputation: 356

Unable to call a pl sql function contained in a package

I have code like :

CREATE OR REPLACE PACKAGE BODY schema_name.abc AS

FUNCTION f1
RETURN CLOB AS
    BEGIN
       <some task>
    END;

PROCEDURE p1
    BEGIN
        f1(<param>);
    END;
END abc;

This package runs fine when we call abc.p1(<parameter>) Now when I try to just run the function of a package in an anonymous block

DECLARE
temp_clb CLOB;

BEGIN
   temp_clb := <schema_name>.abc.f1(<parameter>);
END;

it gives me

PLS-00302: component 'f1'must be declared 

Upvotes: 0

Views: 160

Answers (1)

Sameer Mirji
Sameer Mirji

Reputation: 2245

You need to declare your function in the Package SPEC. Like this:

CREATE OR REPLACE PACKAGE schema_name.abc AS
   FUNCTION f1
   RETURN CLOB;

Upvotes: 2

Related Questions