473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to call a private package level function

M
Hello

I am trying to build an Oracle PL/SQL Package. Some functions should
only be visible from the package, while other functions need to be
called from outside.

I tried the following:

-- begin code snippet ---

create or replace package test
is
FUNCTION MYPUBLICFUNC (parm in integer) return INTEGER;
end;
/
create or replace package body test
AS
FUNCTION MYPUBLICFUNC (parm in integer)
return integer
IS
BEGIN
RETURN test.MYPRIVATEFUNC(parm);
END;

FUNCTION MYPRIVATEFUNC (parm in integer)
return integer
IS
BEGIN
RETURN 3*parm;
END;
END;

-- End Code snippet ---

This results in an Error Message:
PLS-00013: MYPRIVATEFUNC ist für diesen Geltungsbereich nicht
definiert.

What am I doing wrong here ??

Kind Regards
Mat Hess

Please reply to the newsgroup
Jul 19 '05 #1
2 30070
I figured it out.

If I want a function or a procedure to be private, I just add it to
the body of the package. But note: The private function must be
declared before any code that calls it!

create or replace package test
is
FUNCTION MYPUBLICFUNC (parm in integer) return INTEGER;
end;
/
create or replace package body test
AS
-- MUST Declare HERE
FUNCTION MYPRIVATEFUNC (parm in integer)
return integer
IS
BEGIN
RETURN 3*parm;
END;

FUNCTION MYPUBLICFUNC (parm in integer)
return integer
IS
BEGIN
RETURN test.MYPRIVATEFUNC(parm);
END;

-- MUST NOT DECARE HERE!!
END;

Regards Mat

Jul 19 '05 #2
JT
Not quite true. You can use a forward declaration in order to keep the
sub-programs in the order you require:

create or replace package test
is
FUNCTION MYPUBLICFUNC (parm in integer) return INTEGER;
end;
/
create or replace package body test
AS
FUNCTION myprivatefunc(parm IN INTEGER) RETURN INTEGER;

FUNCTION MYPUBLICFUNC (parm in integer)
return integer
IS
BEGIN
RETURN test.MYPRIVATEFUNC(parm);
END;

FUNCTION MYPRIVATEFUNC (parm in integer)
return integer
IS
BEGIN
RETURN 3*parm;
END;

END;
/
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jan van Mansum | last post by:
Hello group, I am trying to generate my API-documentation with PHPDocumentor (http://phpdocu.sourceforge.net/). It works nicely, only I don't understand the package-level documentation...
2
by: srihari | last post by:
Hi , I created a function in oracle using pro*C. I am not sure whether the table got created properly. because when i try to see the description it says, SQL> desc value_1; ERROR: ORA-24372:...
6
by: aling | last post by:
How do you call a regular member function from a static member function? Any idea?
3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
1
by: Martin B | last post by:
Hallo to everyone! Problem: -------- GridView Exception: reentrant call to the SetCurrentCellAddressCore function System: ------- WinXP Professional, english, .NET Framework 2.0 Beta...
5
by: dragon | last post by:
error! 33 E:\program\wukexin\file\file.h `bool My_lib::Cfileinfo::initialize(const char*)' is private 19 E:\program\wukexin\dir\dir.cpp within this context ////////////////////////////////////...
1
by: sivainsearchof | last post by:
Hi, It would be of great help if some one could guide me on the below. I am trying to execute a DTS package created in sql server 2000 from a web application created in asp.net 1.1 using C#. ...
1
by: M | last post by:
Hello I am trying to build an Oracle PL/SQL Package. Some functions should only be visible from the package, while other functions need to be called from outside. I tried the following: --...
2
by: Kristofds | last post by:
Hi, I'm trying to call an Oracle package function from C#, but I keep getting the same error: PLS-00306: wrong number or types of arguments in call to 'F_CTCPREPAREP151HEADER'. This is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.