473,396 Members | 1,666 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.

Calling Oracle Stored Procedure from c#.net 2.0

Hi
I have following code and problem in calling the oracle stored procedure "DEPTREE_FILL"


Here is the Code:

Command.Connection = connection;
Command.CommandText="deptree_fill".ToUpper();
Command.CommandType = CommandType.StoredProcedure;

OracleParameter par1 = new OracleParameter("objectType", OracleType.Char);
par1.Direction = ParameterDirection.Input;
par1.DbType = DbType.String;
par1.Value = new OracleString(objectType); Command.Parameters.Add(par1);

OracleParameter par2 = new OracleParameter("objectOwner", OracleType.Char);
par2.Direction = ParameterDirection.Input;
par2.DbType = DbType.String;
par2.Value = new OracleString(objectOwner); Command.Parameters.Add(par2);

OracleParameter par3 = new OracleParameter("objectName", OracleType.Char);
par3.Direction = ParameterDirection.Input;
par3.DbType = DbType.String;
par3.Value = new OracleString(objectName); Command.Parameters.Add(par3);

OracleParameter par4 = new OracleParameter("out", OracleType.Number);
par4.Direction = ParameterDirection.Output;
par4.DbType = DbType.VarNumeric;
Command.Parameters.Add(par4);

Command.ExecuteNonQuery();



Here is the error message:

ORA-06550: LINE1,COLUMN7;
PLS-00306:WRONG NUMBER OR TYPES OF ARGUMENTS IN CALL TO
"DEPTREE_FILL"
ORA-06550:LINE1, COLUMN7;
PL/SQL:STATEMENT IGNORED
Jun 7 '07 #1
3 8395
debasisdas
8,127 Expert 4TB
Hi
muhammad
Welcome to TSDN.

You have reached the right place for knowledge shairing.

Here you will find a vast resource of related topics and code.

Feel free to post more doubts/questions in the forum.

But before that give a try from your side and if possible try to post what/how you have approached to solve the problem.

It will help Experts in the forum in solving/underestanding your problem in a better way.


Please follow posting guidelines and use code tags to make your post more readable.


It seems yout C# code is ok
but what bout the procedure in oracle.
Is it compiled with out error.

Can you please post the code of the PROCEDURE for my reference.
Jun 7 '07 #2
You can use template code the following such as:
Expand|Select|Wrap|Line Numbers
  1.  
  2. public int SG_SEG_GROUP_INSERT(SG_SEG_GROUP Entity)
  3.         {
  4.             int intResult = 1;
  5.             try
  6.             {
  7.  
  8.                 OracleParameter OraParm;
  9.                 OracleConnection DbConn = GetOracleConnection(strOrcConnection);
  10.                 OracleCommand OraCmd = new OracleCommand(PRO_SG_SEG_GROUP_INSERT, DbConn);
  11.                 OraCmd.CommandType = CommandType.StoredProcedure;
  12.  
  13.                 OraParm = new OracleParameter(PARAM_GRP_TP_ID_SRC, OracleType.VarChar, 64);
  14.                 OraParm.Direction = ParameterDirection.Input;
  15.                 OraParm.Value = Entity.GRP_TP_ID_SRC;
  16.                 OraCmd.Parameters.Add(OraParm);
  17.  
  18.                 OraParm = new OracleParameter(PARAM_GRP_CODE, OracleType.VarChar, 20);
  19.                 OraParm.Direction = ParameterDirection.Input;
  20.                 OraParm.Value = Entity.GRP_CODE;
  21.                 OraCmd.Parameters.Add(OraParm);
  22.  
  23.                 OraParm = new OracleParameter(PARAM_GRP_NM, OracleType.VarChar, 64);
  24.                 OraParm.Direction = ParameterDirection.Input;
  25.                 OraParm.Value = Entity.GRP_NM;
  26.                 OraCmd.Parameters.Add(OraParm);
  27.  
  28.                 OraParm = new OracleParameter(PARAM_DSC, OracleType.VarChar, 255);
  29.                 OraParm.Direction = ParameterDirection.Input;
  30.                 OraParm.Value = Entity.DSC;
  31.                 OraCmd.Parameters.Add(OraParm);
  32.  
  33.                 DbConn.Open();
  34.                 OraCmd.ExecuteNonQuery();
  35.                 DbConn.Dispose();
  36.             }
  37.             catch (Exception ex)
  38.             {
  39.                 intResult = -1;
  40.             }
  41.             return intResult;
  42.         }
  43.  
Oct 9 '10 #3
Expand|Select|Wrap|Line Numbers
  1. public int SG_SEG_GROUP_INSERT(SG_SEG_GROUP Entity)
  2.         {
  3.             int intResult = 1;
  4.             try
  5.             {
  6.  
  7.                 OracleParameter OraParm;
  8.                 OracleConnection DbConn = GetOracleConnection(strOrcConnection);
  9.                 OracleCommand OraCmd = new OracleCommand(PRO_SG_SEG_GROUP_INSERT, DbConn);
  10.                 OraCmd.CommandType = CommandType.StoredProcedure;
  11.  
  12.                 OraParm = new OracleParameter(PARAM_GRP_TP_ID_SRC, OracleType.VarChar, 64);
  13.                 OraParm.Direction = ParameterDirection.Input;
  14.                 OraParm.Value = Entity.GRP_TP_ID_SRC;
  15.                 OraCmd.Parameters.Add(OraParm);
  16.  
  17.                 OraParm = new OracleParameter(PARAM_GRP_CODE, OracleType.VarChar, 20);
  18.                 OraParm.Direction = ParameterDirection.Input;
  19.                 OraParm.Value = Entity.GRP_CODE;
  20.                 OraCmd.Parameters.Add(OraParm);
  21.  
  22.                 OraParm = new OracleParameter(PARAM_GRP_NM, OracleType.VarChar, 64);
  23.                 OraParm.Direction = ParameterDirection.Input;
  24.                 OraParm.Value = Entity.GRP_NM;
  25.                 OraCmd.Parameters.Add(OraParm);
  26.  
  27.                 OraParm = new OracleParameter(PARAM_DSC, OracleType.VarChar, 255);
  28.                 OraParm.Direction = ParameterDirection.Input;
  29.                 OraParm.Value = Entity.DSC;
  30.                 OraCmd.Parameters.Add(OraParm);
  31.  
  32.                 DbConn.Open();
  33.                 OraCmd.ExecuteNonQuery();
  34.                 DbConn.Dispose();
  35.             }
  36.             catch (Exception ex)
  37.             {
  38.                 intResult = -1;
  39.             }
  40.             return intResult;
  41.         }
Oct 9 '10 #4

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

Similar topics

1
by: Adnan | last post by:
I want to read a file list in a directory from a database procedure. I m using Oracle 9i Release 2. How to do??? I don't want to user external procedures. I know it can be done through java stored...
0
by: stephane.traumat | last post by:
Hello, I already succeed to call a stored procedure in Oracle but only simple ones with one output value and several inputs. I don't any idea left so any help would be great :) Thanks But on...
1
by: Jason Leiser | last post by:
Is there a way to call an Oracle Procedure using the MS OLD DB Provider for Oracle object in a SQL Server 2000 DTS package? If it can't be done this way, is there another way to retrieve data from...
2
by: Raj | last post by:
Hi, Does anybody know how to call an oracle stored procedure ( with parameters ofcourse) from MS Access 2002. I want to invoke an oracle stored procedure which takes 2 parameters. Thanks,...
1
by: Jim Heavey | last post by:
Hello, I have an update stored procedure which is in a package. In my code I create all of the paramters and then call the stored procedure with "ExecuteNonQuery()" method of the command. The...
1
by: burtonl | last post by:
I'm using the ADODB abstraction layer and trying to figure out how to call an Oracle stored procedure. It has the following types defined: CREATE OR REPLACE TYPE varchar2_3200_array IS TABLE...
0
by: Tom | last post by:
Looking for some help with stored procedure call issues. Conceptually, I need to pass a data structure as the sole parameter to the Oracle stored procedure. Sounds simple enough....but how? ...
14
by: jehugaleahsa | last post by:
Hello: I am working with Oracle .NET Stored Procedures. I would like to know how to return the results of a SELECT statement. I have tried returning a OracleRefCursor and a DataTable, but...
3
by: Constantine AI | last post by:
Hi we have created a stored procedure to check the dates entered into a lease table does not overlap dates already stored for a lease. However when inserting overlapping lease dates, it allows us to...
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of Access 2003 (11.6566.8107) SP2, Oracle 9i 9.2.0.1.0...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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
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...

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.