我正在使用NPoco ORM並嘗試從Oracle函數中獲取結果。我曾嘗試:執行Oracle函數並獲取返回值
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;
}
但它不能正常工作,並返回ORA-00900: invalid SQL statement
Oracle的功能看起來類似:
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;
您嘗試過'從雙重'選擇PKG_SOMEPACKAGE.SET_DATA(@ p_param1,@ p_param2)嗎? – Stawros
也不起作用 –