472,334 Members | 1,523 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 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 8269
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...
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...
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...
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...
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...
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: ...
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

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.