C# 应用程序 项目实体框架4.7.2 Npgsql 版本 7.0.1
C# 代码调用了一个具有 2 个输入参数并期望 3 个输出参数的过程,当代码执行时,失败并显示 42809:red.common$getreinsurers(timestamp without time zone, timestamp without time zone) is a procedure.
DataSet ds = new DataSet();
cmd.CommandText = "SELECT * FROM red.common$getreinsurers(@p_fromdate,@p_todate)";
cmd.CommandType = CommandType.StoredProcedure;
DateTime dateTime = DateTime.Now;
cmd.Parameters.AddWithValue("@p_fromdate", NpgsqlDbType.Timestamp, dateTime);
cmd.Parameters.AddWithValue("@p_todate", NpgsqlDbType.Timestamp, dateTime);
cmd.Parameters.AddWithValue("p_refcursorreinsurers", NpgsqlDbType.Refcursor);
cmd.Parameters[2].Direction = ParameterDirection.Output;
cmd.Parameters.AddWithValue("p_sqlcode", NpgsqlDbType.Double);
cmd.Parameters[3].Direction = ParameterDirection.Output;
cmd.Parameters.AddWithValue("p_sqlerrm", NpgsqlDbType.Text);
cmd.Parameters[4].Direction = ParameterDirection.Output;
NpgsqlDataAdapter da = new NpgsqlDataAdapter(cmd);
da.Fill(ds);
}
架构
CREATE OR REPLACE PROCEDURE red.common$getreinsurers(IN p_fromdate timestamp without time zone, IN p_todate timestamp without time zone, OUT p_refcursorreinsurers refcursor,
AS
$BODY$timestamp without time zone, IN p_todate timestamp without time zone, OUT p_refcursorreinsurers refcursor,
DECLARE
p_refCursorReinsurers$ATTRIBUTES aws_oracle_data.TCursorAttributes;
BEGIN
p_refCursorReinsurers := NULL;
OPEN p_refCursorReinsurers FOR
SELECT DISTINCT
r.*, tg.name AS tg_name, tg.id AS treaty_group_id, tg.start_date AS tg_start_date, tg.minimum_incident_date AS tg_minimum_incident_date, tg.maximum_incident_date AS tg_maximum_incident_date, tgr.percentage_repayment, tgr.effective_from_date, tgr.effective_to_date
FROM red.treaty_groups AS tg, red.treaty_group_reinsurers AS tgr, red.reinsurers AS r
WHERE tg.id = tgr.treaty_group_id AND tgr.reinsurers_id = r.id AND tgr.effective_from_date <= p_fromdate AND tgr.effective_to_date >= p_todate;
p_refCursorReinsurers$ATTRIBUTES := ROW (TRUE, 0, NULL, NULL);
p_sqlcode := '';
p_sqlerrm := '';
END;
$BODY$