473,386 Members | 1,810 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,386 software developers and data experts.

exception when calling an oracle function

i'm getting the exception:

Parameter 'p1': No size set for variable length data type: String.

my code follows:

OracleCommand cmd = new OracleCommand();
cmd.Connection = oraConn;
cmd.CommandText = "ops$sqltime.pa_new_job_no_fn";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(par1);
par1 = new OracleParameter();
par1.Value = projectNo;
par1.Direction = ParameterDirection.Input;
cmd.Parameters.Add(par1);
int affectedRows = (int) cmd.ExecuteNonQuery();
int ljn = (int) cmd.Parameters["RETURN_VALUE"].Value;

thanks in advance

Nov 17 '05 #1
3 6425
I have not tested it, but Parameter has a Size property that you should set
for string types.

OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
par1.Size = 4000
cmd.Parameters.Add(par1);

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Newbie" <Ne****@discussions.microsoft.com> escribió en el mensaje
news:D0**********************************@microsof t.com...
i'm getting the exception:

Parameter 'p1': No size set for variable length data type: String.

my code follows:

OracleCommand cmd = new OracleCommand();
cmd.Connection = oraConn;
cmd.CommandText = "ops$sqltime.pa_new_job_no_fn";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(par1);
par1 = new OracleParameter();
par1.Value = projectNo;
par1.Direction = ParameterDirection.Input;
cmd.Parameters.Add(par1);
int affectedRows = (int) cmd.ExecuteNonQuery();
int ljn = (int) cmd.Parameters["RETURN_VALUE"].Value;

thanks in advance

Nov 17 '05 #2
it didnt get rid of the exception.

"Carlos J. Quintero [.NET MVP]" wrote:
I have not tested it, but Parameter has a Size property that you should set
for string types.

OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
par1.Size = 4000
cmd.Parameters.Add(par1);

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Newbie" <Ne****@discussions.microsoft.com> escribió en el mensaje
news:D0**********************************@microsof t.com...
i'm getting the exception:

Parameter 'p1': No size set for variable length data type: String.

my code follows:

OracleCommand cmd = new OracleCommand();
cmd.Connection = oraConn;
cmd.CommandText = "ops$sqltime.pa_new_job_no_fn";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(par1);
par1 = new OracleParameter();
par1.Value = projectNo;
par1.Direction = ParameterDirection.Input;
cmd.Parameters.Add(par1);
int affectedRows = (int) cmd.ExecuteNonQuery();
int ljn = (int) cmd.Parameters["RETURN_VALUE"].Value;

thanks in advance


Nov 17 '05 #3
Newbie wrote:
it didnt get rid of the exception.

You added "a" parameter, and Oracle complained specifically
about "p1". Try setting a name for your parameter.

Hans Kesting

"Carlos J. Quintero [.NET MVP]" wrote:
I have not tested it, but Parameter has a Size property that you
should set for string types.

OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
par1.Size = 4000
cmd.Parameters.Add(par1);

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and
VBA You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com

"Newbie" <Ne****@discussions.microsoft.com> escribió en el mensaje
news:D0**********************************@microsof t.com...
i'm getting the exception:

Parameter 'p1': No size set for variable length data type: String.

my code follows:

OracleCommand cmd = new OracleCommand();
cmd.Connection = oraConn;
cmd.CommandText = "ops$sqltime.pa_new_job_no_fn";
cmd.CommandType = CommandType.StoredProcedure;
OracleParameter par1 = new OracleParameter();
par1.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(par1);
par1 = new OracleParameter();
par1.Value = projectNo;
par1.Direction = ParameterDirection.Input;
cmd.Parameters.Add(par1);
int affectedRows = (int) cmd.ExecuteNonQuery();
int ljn = (int) cmd.Parameters["RETURN_VALUE"].Value;

thanks in advance

Nov 17 '05 #4

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

Similar topics

14
by: Michael Winter | last post by:
In an attempt to answer another question in this group, I've had to resort to calling the DOM method, Node.removeChild(), using a reference to it (long story...). That is, passing Node.removeChild....
27
by: garyolsen | last post by:
In C++ what kind of unexpected conditions should be handled as exceptions? Besides dividing by 0, bad memory allocation, what're the most popular exceptions? When should not use exception,...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
3
by: Sean Tynan | last post by:
I want to find out the best way for a method to notify calling code of situations such as validation errors, etc. that may occur during method execution. e.g. say I have a method (business...
7
by: Søren Dreijer | last post by:
Hi, I have a mixed C#, managed C++ and unmanaged C++ project. The managed class calls a method which exists in an unmanaged singleton class. During the entire lifetime of the application, this...
2
by: Richard Collette | last post by:
Hi, I have a service, that runs perfectly when executed outside of the web service environment. When called as a web service I get the exception listed below sporadically. A call to the web...
3
by: JohnDeHope3 | last post by:
First let me say that I understand that Asp.Net wraps my exception in an HttpUnhandledException. I have found a lot of discussion about that on the web, which was informative, but not helpful. Let...
1
by: guzmanp | last post by:
I have this error message: Please anyone knows how I resolve this? An unexpected exception has been detected in native code outside the VM. Unexpected Signal : EXCEPTION_ACCESS_VIOLATION...
12
by: Angus | last post by:
Hello I have a class I am using which raises an exception in its constructor if certain things aren't in place. I can easily create the situation where an exception is raised. If I use the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.