Unable to execute Oracle queries | OracleException (0x80131938): ORA-00947

0

Your help is appreciated to solve the following. Am trying to execute two Oracle queries one after another in C# code. However, I get the following error: 'System.Data.OracleClient.OracleException (0x80131938): ORA-00947: not enough values in updateQuery. I checked the columns and values in the query and count is correct.

Below is the code used

using (con)
        {
         string verifyQuery = "select * from table x where column1='" + value1 + "'";
         using (OracleCommand command = new OracleCommand(verifyQuery, con))
         {
           OracleDataReader drY = command.ExecuteReader();
           if (drY.HasRows)
           {}
           else
           {}
         }
         string updateQuery = "INSERT INTO table x (column) VALUES("+value + ")";
         using (OracleCommand command = new OracleCommand(updateQuery, con))
         {
          try
            {
              OracleDataReader drX = command.ExecuteReader();
              drX = command.ExecuteReader();
              if (drX.HasRows)
              {
               drX.Read();
              }
              else
              {}
            }
            catch (OracleException OEx)
            {
             isUpdated = OEx.ToString();
            }
          }
        }
  output = isUpdated;
  con.Close();
  return output;
}
c#
oracle
asked on Stack Overflow Jul 26, 2020 by Namlas • edited Jul 26, 2020 by Wernfried Domscheit

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0