我对甲骨文很生气。我一直在努力从 oracle 数据库中获取两个值(输出参数)。我需要根据 paymentType 和 vendor 获取两个值(o_unallocated_ledgercode 和 o_allocated_ledgercode)。
问题是:这些值在 C# 中仍然为空。我无法从数据库中获取这些值。可能有什么问题?请看我的 c# 代码。我需要别人的不同观点。我可能错过了什么。请给我代码示例。谢谢!
甲骨文包:
CREATE OR REPLACE package body BANKIMPORTS.pkg_vendor_config as
PROCEDURE get_ledger_codes (i_vendor in varchar2,
i_payment_type in varchar2,
o_allocated_ledgercode out varchar2,
o_unallocated_ledgercode out varchar2) is
BEGIN
IF UPPER (i_payment_type) = 'SUBS' THEN
SELECT CV.CONFIGVALUE
INTO o_unallocated_ledgercode
FROM VENDOR v
JOIN VENDOR_CONFIG_ITEM_VALUE CV ON v.Id = CV.Vendor_Id
JOIN CONFIG_ITEMS c ON CV.Config_Item_Id = c.Config_Item_Id
WHERE C.ITEMNAME = 'Subs_Unallocated_LederCode'
AND V.DESCRIPTION = i_vendor;
SELECT CV.CONFIGVALUE
INTO o_allocated_ledgercode
FROM VENDOR v
JOIN VENDOR_CONFIG_ITEM_VALUE CV ON v.Id = CV.Vendor_Id
JOIN CONFIG_ITEMS c ON CV.Config_Item_Id = c.Config_Item_Id
WHERE C.ITEMNAME = 'Subs_Payment_LedgerCode'
AND V.DESCRIPTION = i_vendor;
ELSIF UPPER (i_payment_type) = 'GOTV'
........same select statement as above
C#代码:
using (DbCommand command = connection.CreateCommand())
{
try
{
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "pkg_vendor_config.get_ledger_codes";
command.AddParameter("i_vendor", DbType.String, vendor, ParameterDirection.Input);
command.AddParameter("i_payment_type", DbType.String, paymentType, ParameterDirection.Input);
command.AddParameter("o_unallocated_ledgercode", DbType.String, ParameterDirection.Output);
command.AddParameter("o_allocated_ledgercode", DbType.String, ParameterDirection.Output);
command.ExecuteNonQuery();
var unallocated = (String)command.Parameters["o_unallocated_ledgercode"].Value;
var allocated = (String)command.Parameters["o_allocated_ledgercode"].Value;