I'm having this error when I call a stored procedure from my ASP.NET page's code-behind. I played with parameters and types but still couldn't figure out the reason.
Error:
ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'PR_SECWEB_GET_MAINTENANCE' ORA-06550: line 1, column 7: PL/SQL: Statement ignored
C# Code-behind method:
public static string GetMaintenanceFlag(string userType)
{
OracleConnection oConnection = new OracleConnection(connectionString);
OracleCommand oCommand = new OracleCommand();
string maintenanceFlag = string.Empty;
try
{
oCommand.CommandType = CommandType.StoredProcedure;
oConnection.Open();
oCommand.CommandText = GET_MAINTENANCE_FLAG;
oCommand.Parameters.Add("v_userType", OracleDbType.Varchar2);
oCommand.Parameters["v_userType"].Value = userType;
oCommand.Parameters.Add("cv_1", OracleDbType.Varchar2, 100);
oCommand.Parameters["cv_1"].Direction = ParameterDirection.Output;
oCommand.Connection = oConnection;
int cnt = oCommand.ExecuteNonQuery();
maintenanceFlag = oCommand.Parameters["cv_1"].Value.ToString();
return maintenanceFlag;
}
catch (Exception ex)
{
SecureWebExceptions oException = new SecureWebExceptions("CommonDAL", "GetMaintenanceFlag", ex);
throw oException;
}
finally
{
if (oConnection.State == ConnectionState.Open)
oConnection.Close();
}
}
Stored Procedure in Oracle:
create or replace PROCEDURE PR_SECWEB_GET_MAINTENANCE
(
v_userType IN VARCHAR2 DEFAULT NULL,
cv_1 OUT VARCHAR2
)
AS
BEGIN
IF UPPER(v_userType)='INTERNAL' THEN
select PARAMETER_VALUE INTO cv_1 from FIC_PARAMETER WHERE PARAMETER_NAME = 'MAINTENANCE_MODE_INTERNAL';
ELSIF UPPER(v_userType)='EXTERNAL' THEN
select PARAMETER_VALUE INTO cv_1 from FIC_PARAMETER WHERE PARAMETER_NAME = 'MAINTENANCE_MODE_EXTERNAL';
END IF;
END;
oCommand.Parameters.Add(new OracleParameter("v_userType", etc))
syntax? – Dominic Cotton