Problem with date parameter - Oracle
Posted
by Nicole
on Stack Overflow
See other posts from Stack Overflow
or by Nicole
Published on 2010-03-30T19:18:33Z
Indexed on
2010/03/30
19:23 UTC
Read the original article
Hit count: 511
Hi everyone! I have this stored procedure:
CREATE OR REPLACE PROCEDURE "LIQUIDACION_OBTENER" ( p_Cuenta IN NUMBER, p_Fecha IN DATE, p_Detalle OUT LIQUIDACION.FILADETALLE%TYPE ) IS
BEGIN
SELECT
FILADETALLE
INTO
p_Detalle
FROM
Liquidacion
WHERE
(FILACUENTA = p_Cuenta)
AND (FILAFECHA = p_Fecha);
END;
and my c# code:
string liquidacion = string.Empty;
OracleCommand command = new OracleCommand("Liquidacion_Obtener");
command.BindByName = true;
command.Parameters.Add(new OracleParameter("p_Cuenta", OracleDbType.Int64));
command.Parameters["p_Cuenta"].Value = cuenta;
command.Parameters.Add(new OracleParameter("p_Fecha", OracleDbType.Date));
command.Parameters["p_Fecha"].Value = fecha;
command.Parameters.Add("p_Detalle", OracleDbType.Varchar2, ParameterDirection.Output);
OracleConnectionHolder connection = null;
connection = this.GetConnection();
command.Connection = connection.Connection;
command.CommandTimeout = 30;
command.CommandType = CommandType.StoredProcedure;
OracleDataReader lector = command.ExecuteReader();
while (lector.Read())
{
liquidacion += ((OracleString)command.Parameters["p_Detalle"].Value).Value;
}
the thing is that when I try to put a value into the parameter "Fecha" (that is a date) the code gives me this error (when the line command.ExecuteReader();
is executed)
Oracle.DataAccess.Client.OracleException : ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "SYSTEM.LIQUIDACION_OBTENER", line 9
ORA-06512: at line 1
the thing is that te date in the data base is saved like a date but it's format is "2010-APR-14" and the value I send is a datetime that has this format: "14/04/2010 00:00:00" could it be that???
I hope my post is understandable.. thanks!!!!!!!!!!
© Stack Overflow or respective owner