473,791 Members | 2,881 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Call a package function from C#: PLS-00306

2 New Member
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_CTCPREPAREP1 51HEADER'.

This is the function declaration in the package:
function f_CtcPrepareP15 1Header
(
as_codjal in varchar2/*,
ad_datdoc in varchar2,
as_codfnr in varchar2,
ad_dtfafo in varchar2,
as_reffnr in varchar2,
as_vcs in varchar2,
as_devfnr in varchar2,
ad_datech in varchar2,
al_totdev in number,
al_tvadev in number,
al_tvafac in number,
as_codtva in varchar2,
as_libele in varchar2,
as_xlogcr in varchar2,
as_typesc in varchar2,
al_pouesc in number,
al_jouesc in number,
al_docrec in number,
as_msglan in varchar2*/,
rs_msgerr in out varchar2
)
return integer;

This is the function declaration in the package body:
function f_CtcPrepareP15 1Header
(
as_codjal in varchar2/*,
ad_datdoc in varchar2,
as_codfnr in varchar2,
ad_dtfafo in varchar2,
as_reffnr in varchar2,
as_vcs in varchar2,
as_devfnr in varchar2,
ad_datech in varchar2,
al_totdev in number,
al_tvadev in number,
al_tvafac in number,
as_codtva in varchar2, -- tvaspe
as_libele in varchar2, -- numero de bon de commande (texte libre)
as_xlogcr in varchar2,
as_typesc in varchar2,
al_pouesc in number,
al_jouesc in number,
al_docrec in number, -- numero de document Recomatics (ctcd15.des001)
as_msglan in varchar2*/,
rs_msgerr in out varchar2
)
return integer
is
begin
/*rs_msgerr := 'test';*/
return 1;
end f_CtcPrepareP15 1Header;

This is the way I call the function:
OleDbCommand l_oCmd1 = new OleDbCommand("P KG_TEMREC.f_ctc PrepareP151Head er", l_oConContracto r);
l_oCmd1.Command Type = CommandType.Sto redProcedure;

l_strExtraInfo = "f_ctcPrepareP1 51Header : Create return parameter";
OleDbParameter l_RetValue1 = l_oCmd1.Paramet ers.Add("RetVal ", OleDbType.Integ er);
l_RetValue1.Dir ection = ParameterDirect ion.ReturnValue ;

l_strExtraInfo = "f_ctcPrepareP1 51Header : Create journal parameter";
OleDbParameter l_oJournalPar1 = new OleDbParameter( "as_codjal" , OleDbType.VarCh ar);
l_oJournalPar1. Direction = ParameterDirect ion.Input;
l_oJournalPar1. Value = l_strJournal;
l_oJournalPar1. Size = l_strJournal.Le ngth;
l_oCmd1.Paramet ers.Add(l_oJour nalPar1);

l_strExtraInfo = "f_ctcPrepareP1 51Header : Create message parameter";
OleDbParameter l_oErrMsgPar1 = l_oCmd1.Paramet ers.Add("rs_msg err", OleDbType.VarCh ar);
l_oErrMsgPar1.D irection = ParameterDirect ion.InputOutput ;
l_oErrMsgPar1.S ize = 4000;
l_oErrMsgPar1.V alue = new String(' ', 4000);

try
{
ExecuteFunction (l_oCmd1, l_oConContracto r, l_oTrans, l_RetValue1, l_oErrMsgPar1, "f_ctcPrepareP1 51Header");
}
catch (Exception e)
{
throw new Exception("Erro r while preparing invoice header: " + e.Message);
}

The function ExecuteFunction is the following:
private void ExecuteFunction (OleDbCommand oCmd, OleDbConnection oConn, OleDbTransactio n oTrans, OleDbParameter oRetValue, OleDbParameter oErrMsg, string strFunctionName )
{
try
{
oCmd.Transactio n = oTrans;
oCmd.ExecuteNon Query();

if ((oRetValue != null) && (oRetValue.Valu e != null))
{
int iOutputValue = Convert.ToInt32 (oRetValue.Valu e.ToString());
if (iOutputValue < 0)
{
throw new Exception(oErrM sg.Value.ToStri ng());
}
}
}
catch (Exception e)
{
string l_strMsg = string.Format(" Exception in procedure PKG_TEMREC." + strFunctionName + " - " + e.Message + "(" + oCmd.CommandTex t + ")");
throw new Exception(l_str Msg);
}
}

Can anybody tell me what I am doing wrong? I know that I have commented out a lot of parameters in the function declaration, but this is for testing purposes.

Thanks,

Kristof.
Oct 2 '09 #1
2 4333
debasisdas
8,127 Recognized Expert Expert
why are you trying to execute a function ? simply use it in SQL statement and pass the list of parameters.
Oct 3 '09 #2
Kristofds
2 New Member
Then how about the in/out parameter?
Oct 5 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4491
by: Kid A | last post by:
I am writing stored proecdures on Oracle 9 (release 1 I believe). I am having difficulty creating a stored procedure that makes a remote function call to a database on a different host. On the remote database I declare the following package: ---------- create or replace package remote_package as
1
5453
by: Per Magnus L?vold | last post by:
Hi, I am trying to create a package under the apps schema, and I keep getting PLS-00201 and ORA-00942 when refering to types from other apps-packages and other views / tables. I even get this error when calling a quite simple: MY_NUM := FND_PROFILE.VALUE('MY_PROFILE_NAME'); Any ideas what I can be doing wrong? This same code was originally part of a trigger code, and worked just
1
2961
by: Onder Kaya | last post by:
Hello everyone, We are trying the compile this package but we get this error. PACKAGE BODY APPS.XNC_BOM_PVT On line:32 PLS-00358:'ASSEMBLY_ITEM_ID' exists in more than one table, use qualifier What should we do to solve this
2
30132
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 ---
0
1089
by: navedkhan | last post by:
here is the scenario i hav an .net application which works on Oracle database 1. I created an application installer in .net it worked fine 2. Then i created a database installer in .net which worked fine and all scripts weere executed without any error via msi... 3. but when i check the database i can see all my tables and data thr ....but the package that is installed is indicated as invalid object.. if i try to compile the...
0
6264
debasisdas
by: debasisdas | last post by:
PACKAGE WITH LOCAL FUNCTION ============================= create or replace package my_pkg as procedure my_proc(arg1 in varchar2); function my_fun(arg1 in number) return varchar2; end my_pkg; PACKAGE BODY
2
10297
by: gagandutta01 | last post by:
Hi, Can anyone tell me how to execute a function declared in Oracle Package from Unix shell script? I created a shell script and after connecting to oracle database i am using exec @ Db_name.Packagename.function_name('p1','P2'); and after executing the shell scripts i am getting the follwing error:-ERROR at line 13: ORA-06550: line 13, column 2: PLS-00221: 'function_name' is not a procedure or is undefined
0
3880
debasisdas
by: debasisdas | last post by:
The following thread contains some useful tips/sample codes regarding PACKAGES in oracle, that the forum members may find useful. A package is a collection of procedures,functions,cursors,global variables etc. A package is also stored as an Object in the database. A package ha s two parts 1. Package-------------Specification. 2. Package body---Implimentaton.
0
3849
debasisdas
by: debasisdas | last post by:
SAMPLE PACKAGE EX#3 ==================== PACKAGE SPECIFICATION -------------------------------------------- CREATE OR REPLACE PACKAGE MYPACK AS PROCEDURE SHOWENAME(EMPID IN NUMBER); FUNCTION SHOWSAL(EMPID IN NUMBER) RETURN NUMBER; END MYPACK;
0
9669
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
10207
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...
0
9993
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
9029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
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
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4109
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
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
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.