Skip to content

Instantly share code, notes, and snippets.

@dkalamari
Last active January 3, 2016 20:39
Show Gist options
  • Save dkalamari/8516726 to your computer and use it in GitHub Desktop.
Save dkalamari/8516726 to your computer and use it in GitHub Desktop.
.NET calling Oracle procedure with Date input parameter and String output parameter
Dim conn As New OracleConnection(oradb)
conn.Open()
Dim cmd As New OracleCommand
cmd.Connection = conn
cmd.CommandText = "procedure1"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("p1", OracleDbType.Varchar2).Value = "Test 123"
cmd.Parameters.Add("p2", OracleDbType.Date).Value = System.DateTime.Now
cmd.Parameters.Add("o1", OracleDbType.Varchar2, 3200)
cmd.Parameters("o1").Direction = ParameterDirection.Output
cmd.BindByName = True // Very important if input parameters aren't ordered in a way procedure expects them
cmd.ExecuteNonQuery()
Dim output = cmd.Parameters("o1").Value.ToString() //Saving procedures output parameter to variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment