473,324 Members | 2,473 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,324 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 30054
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.