Oracle Stored Procedure

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

Guest

If you have created an oracle function which returns a single value, can you
use the "ExecuteScalar" method to return that value? I have tried and I
continue to get an error (Object not set). I have coded my parameter name as
being "RetVal" with an output type of "returnValue". Why can't I run the
"ExecuteScalar" method? I have wrapped a procedure around the function an
called the procedure with a datareader, that works, but it seems that I
should be able to use the "ExecuteScalar" method. Is there a way?
 
Jim said:
If you have created an oracle function which returns a single value, can
you use the "ExecuteScalar" method to return that value? I have tried and I
continue to get an error (Object not set). I have coded my parameter name
as being "RetVal" with an output type of "returnValue". Why can't I run
the "ExecuteScalar" method? I have wrapped a procedure around the function
an called the procedure with a datareader, that works, but it seems that I
should be able to use the "ExecuteScalar" method. Is there a way?

is the function in a package? It should be callable then. Scalar functions
do not work with output parameters as the value to return, you should think
of queries like:
SELECT bla FROM DUAL;

Frans.
 
Jim

Try using ExecuteNonQuery - ExecuteScalar is best used when you want only
the first column of the first row of the results set. The advantage of
ExecuteScalr versus Execute is that, while ExecuteScalar does operate on a
rowset, it does not suffer all of the overhead necessary to construct then
tear down the client side data structure necessary to represent the rowset.

Here is a link relating to Oracle functions (using ODP.Net):
http://www.onecustomer.com/TechArticles/TechArt19.html

regards
roy fine
 
Back
Top