2009年9月8日

ORA-06550 , PLS-00306 ERROR

The error message :

ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'SP_GET_HRF001' ORA-06550: line 1, column 7: PL/SQL: Statement ignored


The .net source code :

OracleConnection sqlConnection = null;
try
{
sqlConnection = GetConnection(System.Configuration.ConfigurationSettings.AppSettings["OracleFbdConnectionString"]);
OracleParameter[] parameters = new OracleParameter[3];
parameters[0] = new OracleParameter("v_agent_id", OracleType.NVarChar);
parameters[0].Direction = ParameterDirection.Input;
parameters[0].Value = AgentID.ToString();
parameters[1] = new OracleParameter("v_idno", OracleType.NVarChar,15);
parameters[1].Direction = ParameterDirection.Output;
parameters[2] = new OracleParameter("v_name", OracleType.NVarChar,12);
parameters[2].Direction = ParameterDirection.Output;
OracleHelper.ExecuteNonQuery(sqlConnection, CommandType.StoredProcedure, "ERP.SP_GET_HRF001", parameters);
return parameters[1].Value.ToString();
}
catch (OracleException ex)
{
logger.Error("SP_GET_HRF001", ex);
throw ex;
}
catch (Exception ex)
{
logger.Error("SP_GET_HRF001", ex);
throw ex;
}
finally
{
if (sqlConnection != null)
{
sqlConnection.Close();
sqlConnection.Dispose();
}
}

The SP Code :

CREATE OR REPLACE PROCEDURE SP_GET_HRF001(v_agent_id IN VARCHAR2, id
v_idno OUT VARCHAR2,
v_name OUT VARCHAR2)
IS

BEGIN
BEGIN
SELECT id_no, chi_name
INTO v_idno, v_name
FROM hrf001
WHERE emp_no IN
(SELECT fbd_id
FROM mis_emp
WHERE emp_id = v_agent_id);
EXCEPTION
WHEN OTHERS THEN
NULL;
END;

END;


The solution :

You must to check the variable must the same name in the .net source code and sp code.



沒有留言:

張貼留言