473,569 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble executing a stored procedure

Hello:

I wrote a test procedure on Oracle that returns a string and a value.

CREATE OR REPLACE PROCEDURE EBMS.p_CSV_Uplo ad
(
P_ERROR OUT VARCHAR2,
P_ERROR_NO OUT Number
)
AS

BEGIN
P_ERROR := 'Test Successful';
P_ERROR_NO := '1';
END;

I then tried to execute the SP from VB.Net. Here's the code snippet:

Dim queryString As String = "p_CSV_Uplo ad"

Using connection As New OracleConnectio n(myConnectionS tring)
Dim command As New OracleCommand(q ueryString)
command.Command Type = CommandType.Sto redProcedure
command.Paramet ers.Add("P_ERRO R", OracleType.VarC har).Direction
= ParameterDirect ion.Output
command.Paramet ers.Add("P_ERRO R_NO", OracleType.Int3 2).Direction
= ParameterDirect ion.Output
command.Connect ion = connection
Try
connection.Open ()
Dim reader As OracleDataReade r = command.Execute Reader()
MsgBox((reader. GetString(0)))
MsgBox((reader. GetInt32(1)))

Catch ex As Exception
Console.WriteLi ne(ex.Message)
End Try
End Using

When I execute, the line, "Dim reader As OracleDataReade r =
command.Execute Reader()" raises an exception, "{"Paramete r 'P_ERROR': No size
set for variable length data type: String."}

What am I doing wrong?

Oct 11 '06 #1
2 2316
Hello:

I solved it partially. I added the length of the string to the parameter:

command.Paramet ers.Add("P_ERRO R", OracleType.VarC har,
100).Direction = ParameterDirect ion.Output

I also changed the syntax using DataReader:

Try
connection.Open ()

Dim reader As OracleDataReade r = command.Execute Reader
MsgBox((reader. GetString(0)))
MsgBox((reader. GetInt32(1)))

Catch ex As Exception
Console.WriteLi ne(ex.Message)
End Try

But the line, MsgBox, throws an exception, " {"No data exists for the row or
column."}

Any idea?

venki

"vvenk" wrote:
Hello:

I wrote a test procedure on Oracle that returns a string and a value.

CREATE OR REPLACE PROCEDURE EBMS.p_CSV_Uplo ad
(
P_ERROR OUT VARCHAR2,
P_ERROR_NO OUT Number
)
AS

BEGIN
P_ERROR := 'Test Successful';
P_ERROR_NO := '1';
END;

I then tried to execute the SP from VB.Net. Here's the code snippet:

Dim queryString As String = "p_CSV_Uplo ad"

Using connection As New OracleConnectio n(myConnectionS tring)
Dim command As New OracleCommand(q ueryString)
command.Command Type = CommandType.Sto redProcedure
command.Paramet ers.Add("P_ERRO R", OracleType.VarC har).Direction
= ParameterDirect ion.Output
command.Paramet ers.Add("P_ERRO R_NO", OracleType.Int3 2).Direction
= ParameterDirect ion.Output
command.Connect ion = connection
Try
connection.Open ()
Dim reader As OracleDataReade r = command.Execute Reader()
MsgBox((reader. GetString(0)))
MsgBox((reader. GetInt32(1)))

Catch ex As Exception
Console.WriteLi ne(ex.Message)
End Try
End Using

When I execute, the line, "Dim reader As OracleDataReade r =
command.Execute Reader()" raises an exception, "{"Paramete r 'P_ERROR': No size
set for variable length data type: String."}

What am I doing wrong?
Oct 11 '06 #2
vvenk,

reader.Read

Kerry Moorman
"vvenk" wrote:
Hello:

I solved it partially. I added the length of the string to the parameter:

command.Paramet ers.Add("P_ERRO R", OracleType.VarC har,
100).Direction = ParameterDirect ion.Output

I also changed the syntax using DataReader:

Try
connection.Open ()

Dim reader As OracleDataReade r = command.Execute Reader
MsgBox((reader. GetString(0)))
MsgBox((reader. GetInt32(1)))

Catch ex As Exception
Console.WriteLi ne(ex.Message)
End Try

But the line, MsgBox, throws an exception, " {"No data exists for the row or
column."}

Any idea?

venki

"vvenk" wrote:
Hello:

I wrote a test procedure on Oracle that returns a string and a value.

CREATE OR REPLACE PROCEDURE EBMS.p_CSV_Uplo ad
(
P_ERROR OUT VARCHAR2,
P_ERROR_NO OUT Number
)
AS

BEGIN
P_ERROR := 'Test Successful';
P_ERROR_NO := '1';
END;

I then tried to execute the SP from VB.Net. Here's the code snippet:

Dim queryString As String = "p_CSV_Uplo ad"

Using connection As New OracleConnectio n(myConnectionS tring)
Dim command As New OracleCommand(q ueryString)
command.Command Type = CommandType.Sto redProcedure
command.Paramet ers.Add("P_ERRO R", OracleType.VarC har).Direction
= ParameterDirect ion.Output
command.Paramet ers.Add("P_ERRO R_NO", OracleType.Int3 2).Direction
= ParameterDirect ion.Output
command.Connect ion = connection
Try
connection.Open ()
Dim reader As OracleDataReade r = command.Execute Reader()
MsgBox((reader. GetString(0)))
MsgBox((reader. GetInt32(1)))

Catch ex As Exception
Console.WriteLi ne(ex.Message)
End Try
End Using

When I execute, the line, "Dim reader As OracleDataReade r =
command.Execute Reader()" raises an exception, "{"Paramete r 'P_ERROR': No size
set for variable length data type: String."}

What am I doing wrong?
Oct 11 '06 #3

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

Similar topics

0
2253
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is running fine, but immediatly after this msaccess hangs, when the focus goes back to the calling form ? Has anyone any idea what i can test or look...
3
22111
by: dinesh prasad | last post by:
I'm trying to use a servlet to process a form, then send that data to an SQL server stored procedure. I'm using the WebLogic 8 App. server. I am able to retrieve database information, so I know my application server can talk to the database. I've determined the failure occurs when the the following statement is executed: cstmt.execute(); (due...
1
3139
by: rvdw | last post by:
Hi All, I've a serious problem with executing stored procedures (SQL2000) from an Access db (version 97). After executing a stored procedure , msaccess hangs. The whole call to the procedure is running fine, but immediatly after this msaccess hangs, when the focus goes back to the calling form ? Has anyone any idea what i can test or look...
1
12130
by: Ville Huovinen | last post by:
Platform: Windows 2003 Server (MS SQL Server 2003 SP3) Language: C# Problem: My stored procedures times out randomly, some proces works fine when using them from C#, and some generate SqlException which states that the server has timed out. The problem isn't in server, neither in stored procedures because they work fine in Sql Server's...
4
5860
by: Stuart Ferguson | last post by:
I am currently writing code to execute SQL Server 2000 Stored procedured using the ODBC.NET SQL Server Driver. The particular stored procedure I am using has multiple paramaters which I have created in my code (OdbcParamater objects), these are then being added to the Command objects paramaters, however when it comes to running the SP the...
1
1459
by: A1 Ronen | last post by:
Hi all I got problem regarding executing all stored procedure through common procedures where we have different parameter with different names, type and data type The Function is as follows Where strProcString is procedure name and strParamString is all parameters concatenated by @
9
15400
by: Leedrick | last post by:
Hi, In the past I have been dealing mainly with sql server, and recently been given the task of supporting software that uses db2 on as400. Simple tasks such as executing a stored procedure from a query window have proven more troublesome than I expected. The procedure I'm trying to call has an output argument. I can't seem to declare...
2
1469
by: staeri | last post by:
When I execute a stored procedure with the following code it takes forever and result in a timeout or a hang: Sub TransformData() Dim myConnection As New SqlConnection(ConnectionString) Dim myCommand As New SqlCommand("spImport_amount_transform", myConnection) myCommand.CommandType = CommandType.StoredProcedure myCommand.CommandTimeout...
2
7464
by: Carlton Kirby | last post by:
I need to execute a job on a SQL Express 2005 instance (no SQLAgent). The job will be executed manually by a user, so it doesn't need to be scheduled to run automatically. I thought I could execute the job through a stored procedure, but it appears that SQL Agent is necessary even for that. The job was given to me by a software vendor to...
0
7698
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7673
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.