7
Answers

C# Calling PACKAGE.PROCEDURE with OUT parameter

Jsue Ngron

Jsue Ngron

7y
342
1
From C# Code, I'm trying to call a PACKAGE.PROCEDURE() from Oracle. In this simple example I should get one value from the procedure call, but all I get is error:
> wrong number or types of arguments in call to 'RETURN_NUM'
The procedure is declared as follows:
  1. PROCEDURE return_num(xNum OUT NUMBER) AS  
  2. BEGIN  
  3. xNum:= 50;  
  4. dbms_output.put_line('hello world ' || xNum);  
  5. END;  
C# code:
  1. Oraclecon.Open();  
  2. OleDbCommand myCMD = new OleDbCommand("TEST.return_num", Oraclecon);  
  3. myCMD.CommandType = CommandType.StoredProcedure;  
  4. myCMD.Parameters.Add("xNum", OleDbType.Numeric);  
  5. OleDbDataReader myReader;  
  6. myReader = myCMD.ExecuteReader();  
Can some one please point out what I'm doing wrong. Then in a real scenario I would like to call a procedure that returns a set of values from a custom Type, such as:
  1. TYPE r_interface_data IS RECORD  
  2. (  
  3. object_id VARCHAR2(16),  
  4. obj_type VARCHAR2(32)  
  5. );  
  6. TYPE t_interfase_data IS TABLE OF r_interface_data;  
How can I approach that. Thanks!
Answers (7)