Ora - 01810 RRS feed

  • Question

  • User-541003552 posted

    Hi All,

    I am using the below code to compare datetime stored in oracle DB and todays date.

    But I am having this error that says 

    ORA-01810: format code appears twice

     OracleConnection conn = new OracleConnection(strEco);
                OracleCommand cmd = new OracleCommand("SELECT Count(BATCH_NO)AS Items FROM DETB_UPLOAD  WHERE BATCH_NO = :BATCH_NO AND TO_DATE(UPLOAD_DATE, 'dd-MMMM-yyyy') = :UPLOAD_DATE", conn);
                cmd.Parameters.AddWithValue(":BATCH_NO", RadTxtBatchNo.Text);
                cmd.Parameters.AddWithValue(":UPLOAD_DATE", DateTime.Now.ToString("dd-MMMM-yyyy"));
                OracleDataReader dr = cmd.ExecuteReader();

    How can it be fixed

    Monday, July 27, 2015 9:21 AM

All replies

  • User269602965 posted

    Good idea to issue CLEAR parameters before defining parameters

    Good idea to define parameter datatype in parameter statement

    and in Oracle SQL


    formatting is


    to match your .NET formatting


    Monday, July 27, 2015 9:53 AM