我已经成功创建了一个包。但是当我尝试在我的 C# 程序上调用它时,我收到一个错误:调用 LOG_STATUS 时参数的数量或类型错误
LOG_STATUS 是过程的名称:
CREATE OR REPLACE PACKAGE BODY ITMON.SERVERSTATUS AS
PROCEDURE LOG_STATUS(out_RESULT OUT sys_refcursor)
IS
BEGIN
OPEN out_RESULT FOR
SELECT HOSTNAME, USERS, PS_NAME
FROM PS_COLLECT
WHERE NOT EXISTS
(
SELECT HOSTNAME, USERS, PS_NAME
FROM PS_MASTER
WHERE PS_MASTER.HOSTNAME = PS_COLLECT.HOSTNAME
AND PS_MASTER.USERS = PS_COLLECT.USERS
AND PS_MASTER.PS_NAME = PS_COLLECT.PS_NAME
);
END LOG_STATUS;
END;
这是我的 C# 代码:
OracleCommand OCom = new OracleCommand("SERVERSTATUS.LOG_STATUS", oc);
OCom.CommandType = CommandType.StoredProcedure;
OCom.Parameters.Add("out_RESULT", OracleType.VarChar, 30000).Direction = ParameterDirection.Output;
OCom.Parameters[0].Value = sid;
OracleDataAdapter _daGrid1 = new OracleDataAdapter(OCom);
_daGrid1.Fill(_dsGrid);