Training
Module
Create stored procedures and user-defined functions - Training
This content is a part of Create stored procedures and user-defined functions.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This Visual Basic example executes a PL/SQL stored procedure that returns two REF CURSOR parameters, and reads the values using an OracleDataReader.
Private Sub Button1_Click( _
ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim connString As New String("...")
Using conn As New OracleConnection(connString)
Dim cmd As New OracleCommand()
Dim rdr As OracleDataReader
conn.Open()
cmd.Connection = conn
cmd.CommandText = "CURSPKG.OPEN_TWO_CURSORS"
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add(New OracleParameter( _
"EMPCURSOR", OracleType.Cursor)).Direction = _
ParameterDirection.Output
cmd.Parameters.Add(New OracleParameter(_
"DEPTCURSOR", OracleType.Cursor)).Direction = _
ParameterDirection.Output
rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
While (rdr.Read())
REM do something with the values from the EMP table
End While
rdr.NextResult()
While (rdr.Read())
REM do something with the values from the DEPT table
End While
rdr.Close()
End Using
End Sub
Training
Module
Create stored procedures and user-defined functions - Training
This content is a part of Create stored procedures and user-defined functions.
Documentation
REF CURSOR Parameters in an OracleDataReader - ADO.NET
Learn more about REF CURSOR parameters in an OracleDataReader by studying an example that executes a PL/SQL stored procedure.
Learn more about: Oracle REF CURSORs
Learn more about: REF CURSOR Examples
Filling a DataSet Using One or More REF CURSORs - ADO.NET
Learn more about filling a DataSet using one or more REF CURSORs by studying a Visual Basic code example.