I am using NPoco ORM and trying to get a result from Oracle function. I have tried:
public string GetData(int param1, int param2)
{
var command = "PKG_SOMEPACKAGE.SET_DATA( @p_param1, @p_param2);";
var sql = Sql.Builder.Append(command, new { p_param1 = 10, p_param2 = 20 });
string result = this.Db.ExecuteScalar<string>(sql);
return result;
}
But it doesn't work and returns ORA-00900: invalid SQL statement
The Oracle function looks something like:
function SET_DATA
(
p_param1 IN NUMBER,
p_param2 IN NUMBER
) return varchar2 IS
BEGIN
IF some condition is true THEN
RETURN 'Y';
END IF;
-- some logic
RETURN 'N';
END;
Make sure that you have working SQL statement by running function execution in oracle client. Than potentionally modify your code. If even that isnt working than just run some databaze profiler (e.g. mssql have database profiler) to see what sql statement is your application actually sending to your oracle server.