OracleCommand.ExecuteScalar

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to use OracleCommand.ExecuteScalar to return a single value from an Oracle stored procedure. However it return 'null' when the out parameter is a REF CURSOR, and 'Nothing' when the out parameter is a Number.
 
Execute scalar doesn't return the value of output parameters (it does update
them but that's not the return value), it returns the first column in the
first row of the returned recordset.

Jerry

smay said:
I'm trying to use OracleCommand.ExecuteScalar to return a single value
from an Oracle stored procedure. However it return 'null' when the out
parameter is a REF CURSOR, and 'Nothing' when the out parameter is a Number.
 
You do not return it through parameters, you return it by running a SELECT
statement. Like this (Oracle syntax might be a little differenet):

CREATE PROCEDURE [dbo].[myproc] @input int AS

SELECT COUNT(*) FROM [dbo].
WHERE [column] = @input

Jerry

smay said:
I'm new to Oracle. How do I return a "recordset" from my stored procedure
so that OracleCommand.ExecuteScalar can pick it up? What type of out
parameter do I use, REF CURSOR and NUMBER don't work?
 
Back
Top