HighTechTalks DotNet Forums  

Stored Procedure ORACLE with Output Parameters

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss Stored Procedure ORACLE with Output Parameters in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
eny
 
Posts: n/a

Default Stored Procedure ORACLE with Output Parameters - 11-14-2006 , 11:28 AM






Hi all

I'm tryng to use MSDAORA access in a Oracle 9 database.
I have a stored procedure named TEST with this Sign :
PROCEDURE TEST
(
PC_01 IN VARCHAR2
,PC_02 IN VARCHAR2
,PO_01 OUT INTEGER
,PO_02 OUT VARCHAR2
)

....
i'have a button that start the store:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
'con oracle:
Dim conn As New System.Data.OracleClient.OracleConnection
conn.ConnectionString = "Data Source=port22;Persist Security
Info=True;User ID=cont_amm;Password=cont_amm;Unicode=True"
conn.Open()
Dim sql As String = "TEST"
Dim cmd As New OracleCommand(sql, conn)
cmd.CommandType = CommandType.StoredProcedure
Dim Par_01 As New OracleParameter("STPAR01", OracleType.VarChar)
Par_01.Size = 400
Par_01.Value = CType("ZZZZZZ", System.Data.OracleClient.OracleString)
cmd.Parameters.Add(Par_01)
Dim Par_02 As New OracleParameter("STPAR02", OracleType.VarChar)
Par_02.Value = "YYYYYY"
cmd.Parameters.Add(Par_02)
Dim Par_03 As New OracleParameter("STPAR03", OracleType.Number)
Par_03.Direction = ParameterDirection.Output
cmd.Parameters.Add(Par_03)
Dim Par_04 As New OracleParameter("STPAR04", OracleType.VarChar)
Par_04.Direction = ParameterDirection.Output
Par_04.Size = 3000
cmd.Parameters.Add(Par_04)
Try
Dim dr As OracleDataReader = cmd.ExecuteScalar
Catch et As OracleException
Dim errorMessage As String = "Code: " & et.Code & vbCrLf & _
"Message: " & et.Message
Label2.Text = errorMessage
End Try
conn.Close()
End Sub
End Class

i cath the exception:
Code: 6550
Message: ORA-06550: line1, column 7:
PLS-00306: wrong number of types of arguments in call to 'TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I'm not sure about cmd.ExecuteScalar

do I miss anything? please help and advise... thanks!


Reply With Quote
  #2  
Old   
Tim Van Wassenhove
 
Posts: n/a

Default Re: Stored Procedure ORACLE with Output Parameters - 11-15-2006 , 03:02 PM






On 2006-11-14, eny <eny (AT) discussions (DOT) microsoft.com> wrote:
Quote:
Code: 6550
Message: ORA-06550: line1, column 7:
PLS-00306: wrong number of types of arguments in call to 'TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
It means you're not passing the right number of arguments.

Quote:
I'm not sure about cmd.ExecuteScalar
Your PROCEDURE does not return anything, so you should use cmd.ExecuteNonQuery instead.

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.be>


Reply With Quote
  #3  
Old   
eny
 
Posts: n/a

Default Re: Stored Procedure ORACLE with Output Parameters - 11-17-2006 , 02:45 AM



I have triede: the problem is the same.

If i try with OLE Db access, i have not problem (with ExcecuteScalar)

Dim Conn01 As String = "Provider=MSDAORA;Data Source=port22;Persist
Security Info=True;Password=cont_amm;User ID=cont_amm"
Dim sql As String = "TEST"
Dim cmd As New OleDbCommand(sql, Conn01)
cmd.CommandType = CommandType.StoredProcedure
Dim Par_01 As New OleDbParameter("STPAR01", OleDbType.VarChar)
Par_01.Value = "CIPPI"
cmd.Parameters.Add(Par_01)
Dim Par_02 As New OleDbParameter("STPAR02", OleDbType.VarChar)
Par_02.Value = "ZIPPI"
cmd.Parameters.Add(Par_02)
Dim Par_03 As New OleDbParameter("STPAR03", OleDbType.Integer)
Par_03.Direction = ParameterDirection.Output
cmd.Parameters.Add(Par_03)
Dim Par_04 As New OleDbParameter("STPAR04", OleDbType.VarChar)
Par_04.Direction = ParameterDirection.Output
cmd.Parameters.Add(Par_04)
Par_04.Size = 3000
'Par_04.Value = " "
Dim dr As OleDbDataReader = cmd.ExecuteScalar
TextBox1.Text = Par_03.Value & " / " & Par_04.Value


I'have the proble with Oracle Access!


"Tim Van Wassenhove" wrote:

Quote:
On 2006-11-14, eny <eny (AT) discussions (DOT) microsoft.com> wrote:
Code: 6550
Message: ORA-06550: line1, column 7:
PLS-00306: wrong number of types of arguments in call to 'TEST'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

It means you're not passing the right number of arguments.

I'm not sure about cmd.ExecuteScalar

Your PROCEDURE does not return anything, so you should use cmd.ExecuteNonQuery instead.

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.be


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.