我花了很多时间调查这个问题,即使我在这个网站上发现很少有类似的帖子但没有用。
如果有人可以帮助我。
以下是例外情况:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'AUTOPROVGETUSERGROUPS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
C#代码:
public static List<CHPGroupishObject> ConnectThirdPartyOracleDBForData(string connectionstring, string SPName, string Filter, string Param2, string Param3, string Param4)
{
DataSet result;
List<CHPGroupishObject> lstCHPGroupishObject = new List<CHPGroupishObject>();
CHPGroupishObject cHPGroupishObject = null;
try
{
DbMain objDbHandler = new DbMain(connectionstring);
RetResult resultObject = new RetResult();
ArrayList colParams = new ArrayList();
OracleParameter param = new OracleParameter("Filter", OracleType.VarChar, 300, ParameterDirection.Input, "", DataRowVersion.Default, true, Filter);
colParams.Add(param);
param = new OracleParameter("Param2", OracleType.VarChar, 300, ParameterDirection.Input, "", DataRowVersion.Default, true, Param2);
colParams.Add(param);
param = new OracleParameter("Param3", OracleType.VarChar, 300, ParameterDirection.Input, "", DataRowVersion.Default, true, Param3);
colParams.Add(param);
param = new OracleParameter("Param4", OracleType.VarChar, 300, ParameterDirection.Input, "", DataRowVersion.Default, true, Param4);
colParams.Add(param);
param = new OracleParameter("RefCursor", OracleType.Cursor, 4000, ParameterDirection.Output, "", DataRowVersion.Default, true, null);
colParams.Add(param);
result = objDbHandler.ExecuteProcedure(SPName, "GARSAccount", ref colParams);
foreach (DataRow row in result.Tables[0].Rows)
{
cHPGroupishObject = new CHPGroupishObject();
cHPGroupishObject.dn = row["EntitlementCode"].ToString();
cHPGroupishObject.Name = row["EntitlementName"].ToString();
lstCHPGroupishObject.Add(cHPGroupishObject);
}
return lstCHPGroupishObject;
}
catch (Exception ex)
{
return null;
}
}
Oracle 存储过程:
CREATE OR REPLACE PROCEDURE AEP_SYSTEMATIC.AUTOPROVGETUSERGROUPS(
Filter IN VARCHAR, -- Clone id. Pass null unless Param2 is 'Clone from user'
Param2 IN VARCHAR, -- MyAccess profile
Param3 IN VARCHAR,
Param4 IN VARCHAR,
RefCursor OUT SYS_REFCURSOR)
AS
cloneUser varchar(200);
num_users number;
sqlErr varchar2(4000);
begin
if (Filter is null or Filter = '') then
insert into AEP_SYSTEMATIC.AUTOPROVLOG(MESSAGETYPE, MESSAGE, USERNAME)
values ('INFO', 'GetUserGroups requested with blank clone user', 'MyAccess');
commit;
open RefCursor for
select 'FAIL' as Result, 'No clone user provided' as Message from dual;
return;
end if;
cloneUser := trim(Filter);
insert into AEP_SYSTEMATIC.AUTOPROVLOG(MESSAGETYPE, MESSAGE, USERNAME)
values ('INFO', 'Getting user groups for ' || cloneUser || ' ' || Param2, cloneUser);
commit;
select count(USER_NAME) into num_users from AEP_SYSTEMATIC.DRC_USERS where USER_NAME = cloneUser;
if (num_users = 0) then
insert into AEP_SYSTEMATIC.AUTOPROVLOG(MESSAGETYPE, MESSAGE, USERNAME)
values ('ERROR', 'Failed to find USER_NAME for user ' || cloneUser, cloneUser);
commit;
open RefCursor for
select 'FAIL' as Result, 'Failed to find USER_NAME for user ' || cloneUser as Message from dual;
return;
else
OPEN RefCursor FOR
select distinct '[UserGroup:' || u.RIGHTS || ']' as EntitlementCode,
u.RIGHTS || ' - ' || ug.DESCRIPTION as EntitlementName
from AEP_SYSTEMATIC.DRC_USERS u, AEP_SYSTEMATIC.DRC_USER_GROUPS ug
where
(
cloneUser is null or not cloneUser is null and RIGHTS in
(select RIGHTS from AEP_SYSTEMATIC.DRC_USERS where USER_NAME = cloneUser)
)
and u.RIGHTS = ug.USER_GROUP;
end if;
exception when others then
sqlErr := sqlerrm;
insert into AEP_SYSTEMATIC.AUTOPROVLOG(MESSAGETYPE, MESSAGE, USERNAME)
values('ERROR', substr(sqlErr, 1, 1800), cloneUser);
commit;
open RefCursor for
select 'FAIL' as Result, 'Error in AutoProvGetUserGroups: ' || substr(sqlErr, 1, 500) as Message from dual;
end AUTOPROVGETUSERGROUPS;
/
GRANT EXECUTE ON AEP_SYSTEMATIC.AUTOPROVGETUSERGROUPS TO AEP_SYSTEMATIC_RO_ROLE
/