我正在使用Visual Studio 2010 asp.net 4.5 Oracle 10.2.0.1。
这是我用于检查用户凭据的存储库代码:
using (OracleConnection oracleConnection = new BaseRepository().Connection)
{
oracleConnection.Open();
OracleCommand command = new OracleCommand("PACKAGE_ACCOUNT.USP_GET_USER_BY_CREDENTIALS", oracleConnection);
command.CommandType = System.Data.CommandType.StoredProcedure;
command.Parameters.Add("SP_CURSOR", OracleDbType.RefCursor, System.Data.ParameterDirection.Output);
command.Parameters.Add("SP_LOGIN_NAME", OracleDbType.Varchar2, 50, loginName, System.Data.ParameterDirection.Input);
command.Parameters.Add("SP_LOGIN_PASSWORD", OracleDbType.Varchar2, 50, Security.EncryptText(loginPassword), System.Data.ParameterDirection.Input);
Mapper.CreateMap<IDataReader, ApplicationUser>();
dataReader = command.ExecuteReader(); // exception arises here.
List<ApplicationUser> lstUsers = Mapper.Map<List<ApplicationUser>>(dataReader);
return lstUsers.FirstOrDefault();
}
这是包规范:
CREATE OR REPLACE PACKAGE PACKAGE_ACCOUNT
AS
TYPE T_CURSOR IS REF CURSOR;
PROCEDURE USP_GET_USER_BY_CREDENTIALS(SP_CURSOR OUT T_CURSOR, SP_LOGIN_NAME IN VARCHAR2, SP_LOGIN_PASSWORD IN VARCHAR2);
END PACKAGE_ACCOUNT;
/
这是我的包裹身体:
CREATE OR REPLACE PACKAGE BODY PACKAGE_ACCOUNT
AS
PROCEDURE USP_GET_USER_BY_CREDENTIALS(SP_CURSOR OUT T_CURSOR, SP_LOGIN_NAME IN VARCHAR2, SP_LOGIN_PASSWORD IN VARCHAR2)
IS
BEGIN
OPEN SP_CURSOR FOR
SELECT "ApplicationUser".*, ora_rowscn as TimeStamp
FROM "ApplicationUser"
WHERE "LoginName" = SP_LOGIN_NAME
AND "LoginPassword" = SP_LOGIN_PASSWORD
AND "IsDeleted" = 'N';
END USP_GET_USER_BY_CREDENTIALS;
END PACKAGE_ACCOUNT;
/
例外是:
ORA-04063: package body "OPTIMUS_USER.PACKAGE_ACCOUNT" has errors
ORA-06508: PL/SQL: could not find program unit being called: "OPTIMUS_USER.PACKAGE_ACCOUNT"
ORA-06512: at line 1
我不知道问题出在哪里。
在oracle主页中运行包体脚本时。它给出了错误:
第5行的错误:PL / SQL:忽略SQL语句。
答案 0 :(得分:1)
请检查OPTIMUS_USER架构,架构是否包含包PACKAGE_ACCOUNT或PACKAGE_ACCOUNT帐户架构属于任何其他架构。