473,765 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.MYPRIVATEF UNC(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 30127
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.MYPRIVATEF UNC(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(p arm IN INTEGER) RETURN INTEGER;

FUNCTION MYPUBLICFUNC (parm in integer)
return integer
IS
BEGIN
RETURN test.MYPRIVATEF UNC(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
1616
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 functionality. What I would like to do is replace the "Welcome to ... package" text with something more meaningful. I thought it would be as easy as the package.html in JavaDoc, but doesn't seem to be so.
2
14683
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: invalid object for describe also when i try to use the following query,
6
1464
by: aling | last post by:
How do you call a regular member function from a static member function? Any idea?
3
11878
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 to-be-developed-function cmdOkay_Click() function as described below. 1. Create an user control that contains an OK button as below Public Class MyButton:System.Windows.Form.UserControl
1
7556
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 Language C#
5
1865
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 //////////////////////////////////// #ifndef fileH #define fileH //// #include "windows.h" namespace My_lib{
1
2488
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#. I tried the same code with a windows application and was able to execute. The code that i had used.
1
557
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: -- begin code snippet ---
2
4330
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 function declaration in the package: function f_CtcPrepareP151Header ( as_codjal in varchar2/*, ad_datdoc in varchar2, as_codfnr in varchar2,
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5419
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.