SYS_REFCURSOR

SYS_REFCURSOR

Postby Alladin » Thu 13 May 2010 20:23

Sorry to bother you guys again,
I know that in Ukraine now is good weather, but...

I have a stored function:

Code: Select all
create or replace function TestStoredFunction() return sys_refcursor
as   
  result sys_refcursor;
begin
  open result for select 0 as Result, Sys_Guid() from dual;
  return result;
end;


Code: Select all
var cmd = conn.CreateCommand()
{
   CommandType = CommandType.StoredProcedure,
   CommandText = "TestStoredFunction",
};
var reader = cmd.ExecuteReader();


Could anyone explain, why I'm getting exception:
Code: Select all
PLS-00221: 'TESTSTOREDFUNCTION' is not a procedure or is undefined


Why can't a call a stored function? What am I doing wrong?
Alladin
 
Posts: 149
Joined: Mon 27 Nov 2006 16:18

Postby StanislavK » Mon 17 May 2010 12:34

To execute a stored function you need to populate the Parameters collection of the OracleCommand object. You may either add them manually or set the OracleCommand.ParameterCheck property to true.

Feel free to contact us if something is unclear.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle