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

call a STORED PROCEDURE (oracle) from C#

I have a procedure with a lot of parameters:

....
var IN BOOLEAN DEFAULT FALSE,
....

and one variable is a boolean.

How can I put the bool parameter into this stored procedure from c#?

I've tried :

OracleParameter op5 = new OracleParameter("var", 1);
op5.Direction = ParameterDirection.Input;
cmd.Parameters.Add(op5);

but I receive always the same error:

System.Data.OracleClient.OracleException: ORA-06550: riga 1, colonna 7:
PLS-00306: numero o tipi di argomenti errati nella chiamata di 'myproc'
ORA-06550: riga 1, colonna 7:
PL/SQL: Statement ignored

Any idea ?

Jun 16 '06 #1
3 11593
RicercatoreSbadato wrote:
I have a procedure with a lot of parameters:

...
var IN BOOLEAN DEFAULT FALSE,
...

and one variable is a boolean.

How can I put the bool parameter into this stored procedure from c#?

I've tried :

OracleParameter op5 = new OracleParameter("var", 1);
op5.Direction = ParameterDirection.Input;
cmd.Parameters.Add(op5);

but I receive always the same error:

System.Data.OracleClient.OracleException: ORA-06550: riga 1, colonna
7: PLS-00306: numero o tipi di argomenti errati nella chiamata di
'myproc' ORA-06550: riga 1, colonna 7:
PL/SQL: Statement ignored

Any idea ?


BOOLEAN is a surrogate type, you should simply pass a NUMBER value.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jun 16 '06 #2

"RicercatoreSbadato" <em***********@yahoo.it> wrote in message
news:11**********************@y41g2000cwy.googlegr oups.com...
I have a procedure with a lot of parameters:

...
var IN BOOLEAN DEFAULT FALSE,
...

and one variable is a boolean.

How can I put the bool parameter into this stored procedure from c#?

I've tried :

OracleParameter op5 = new OracleParameter("var", 1);
op5.Direction = ParameterDirection.Input;
cmd.Parameters.Add(op5);

but I receive always the same error:

System.Data.OracleClient.OracleException: ORA-06550: riga 1, colonna 7:
PLS-00306: numero o tipi di argomenti errati nella chiamata di 'myproc'
ORA-06550: riga 1, colonna 7:
PL/SQL: Statement ignored


There are a number of PL/SQL types that aren't directly accessable from
..NET. The general solution to those situations is to code a custom PL/SQL
block that marshals .NET compatible types.
Use an OracleCommand with CommandType.Text something like

DECLARE
lnum NUMBER(1) := :pVar;
lvar BOOLEAN;
BEGIN
if lnum = 1
lvar := TRUE;
elsif
lvar := FALSE;
endf;

MyOracleProc(lvar);
END;
Here pVar is a bind variable, and you would bind a numeric OracleParameter
to it.

David

Jun 16 '06 #3
I've called a function() from a select. This function() calls the
procedure. I've solved the problem in this way. Thanks.

Jun 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: aychai | last post by:
Hi all, I am trying to make use Oracle9i db to call an external .Net Web Service from a JAva Stored Procedure. I created the .Net Web Service and use JDeveloper 9.0.3.4Build(1247) to create...
6
by: Eugene A | last post by:
Hello. In this call from a Java prog to a Oracle SP I am trying to pass along some varchars and a cursor, but apperently the syntax of the call to the stor proc is incorrect. What am I doing...
1
by: robin via SQLMonster.com | last post by:
I've tried several different way to execute a oracle stored procedure from a DTS package but to no avail. I have a Linked Server setup which does bring back Oracle tables from the server when I...
3
by: Mike P | last post by:
Is it possible to return a dataset from a stored procedure, or would you need to write the SQL in your .cs file to return the dataset? Any assistance would be really appreciated. Cheers, ...
12
by: Newbie | last post by:
how can i call an oracle function to get data without using a select statement or stored procedures? given a project_no, i need to call the function: ops$sqltime.pa_new_job_no_fn which will...
3
by: Marcin Wasilewski | last post by:
Hi, I have a problem with calling procedure with parametrs. After run this code: .... Set strCommand = New ADODB.Command strCommand.ActiveConnection = cnn strCommand.CommandText =...
0
by: istruttorenuoto | last post by:
hi! I have some problems to call a stored procedure from an Unix Script. Here's the script stty istrip stty erase ^H export ORACLE_BASE=/product/oracle export...
2
by: Problematic coder | last post by:
I have a form based application that inputs values into various oracle tables, after it has done this I want to call a stored proceedure in Oracle which is already written to do more work on this...
0
by: pbaillard | last post by:
Here a sample to call a stored procedure with an Oracle Database. odc.Connection = m_cDb ' use an open connection to your database odc.CommandType = CommandType.StoredProcedure odc.CommandText =...
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...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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.