title: Oracle database - ORA-01460 - unimplemented or unreasonable conversion requested
body: <p>I'm getting an error message:  unimplemented or unreasonable conversion requested using the following code:</p>
  
  <pre><code>OdbcConnection oConn = new OdbcConnection();
  oConn.ConnectionString = @"Driver={Oracle ODBC Driver};Data Source=*****;UID=********;PWD=******;DBQ=*****;DBA=R;APA=T;FEN=T;QTO=F;FRC=10;FDL=10;LOB=F;RST=T;FRL=T;MTS=F;CSR=F;PFC=10;TLO=0;";
  
  oConn.Open();
  
  string user = "ANYUSER";
  string family = "ANYFAMILY";
  DateTime date = DateTime.Today;
  
  OdbcCommand FindCases = new OdbcCommand(@"select TABLE_CASE.ID_NUMBER, TABLE_USER.LOGIN_NAME
                                            from TABLE_CASE, TABLE_USER, TABLE_PRIVCLASS, TABLE_CONDITION, TABLE_PART_NUM
                                            where TABLE_CASE.CASE_ORIGINATOR2USER=TABLE_USER.OBJID and TABLE_CASE.CASE_STATE2CONDITION=TABLE_CONDITION.OBJID and TABLE_CASE.CASE_PRT2PART_INFO=TABLE_PART_NUM.OBJID
                                            and TABLE_USER.USER_ACCESS2PRIVCLASS=TABLE_PRIVCLASS.OBJID and TABLE_USER.LOGIN_NAME=? and TABLE_PART_NUM.FAMILY=? and TABLE_CONDITION.S_TITLE='CLOSED' and TABLE_CASE.CREATION_TIME &gt; to_date(?,'MM/DD/YYYY HH:MI:SS AM')", oConn);
  
  FindCases.CommandType = System.Data.CommandType.Text;
  FindCases.Parameters.Add(@"user", OdbcType.Text, 4000).Value = user;
  FindCases.Parameters.Add(@"family", OdbcType.Text, 4000).Value = family;
  FindCases.Parameters.Add(@"date", OdbcType.DateTime, 4000).Value = date;
  
  if (oConn.State == System.Data.ConnectionState.Open)
  {
       try
       {
           OdbcDataReader readCases = FindCases.ExecuteReader(); //errors at this line
  </code></pre>
  
  <p>I have looked around online and the only suggestion I could find was using a to_clob statement. Either I don't understand how it works or that doesn't fix the issue. To my knowledge there shouldn't be any coversion of data types. The 'user' field is text, the 'family' field is text, and the 'date' field is DateTime in the database.</p>
  
  <p>Any ideas are very apreciated!</p>
  
  <p><strong>UPDATE</strong>
  This code works:</p>
  
  <pre><code>OdbcCommand FindCases = new OdbcCommand(@"select TABLE_CASE.ID_NUMBER, TABLE_USER.LOGIN_NAME
                                                      from TABLE_CASE, TABLE_USER, TABLE_PRIVCLASS, TABLE_CONDITION, TABLE_PART_NUM
                                                      where TABLE_CASE.CASE_ORIGINATOR2USER=TABLE_USER.OBJID and TABLE_CASE.CASE_STATE2CONDITION=TABLE_CONDITION.OBJID and TABLE_CASE.CASE_PRT2PART_INFO=TABLE_PART_NUM.OBJID
                                                      and TABLE_USER.USER_ACCESS2PRIVCLASS=TABLE_PRIVCLASS.OBJID and TABLE_USER.LOGIN_NAME=? and TABLE_PART_NUM.FAMILY='Desktop' and TABLE_CONDITION.S_TITLE='CLOSED' and TABLE_CASE.CREATION_TIME &gt; ?", oConn);
  
          FindCases.CommandType = System.Data.CommandType.Text;
          FindCases.Parameters.Add(@"user", OdbcType.Text, 4000).Value = user;
          //FindCases.Parameters.Add(@"family", OdbcType.Text, 4000).Value = family;
          FindCases.Parameters.Add(@"date", OdbcType.DateTime, 4000).Value = date;
  </code></pre>
  
  <p><strong>UPDATE (AGAIN)</strong></p>
  
  <p>This code also works perfectly although vulnerable to SQL injection.</p>
  
  <pre><code>        OdbcCommand FindCases = new OdbcCommand(@"select TABLE_CASE.ID_NUMBER
                                                      from TABLE_CASE, TABLE_USER, TABLE_PRIVCLASS, TABLE_CONDITION, TABLE_PART_NUM
                                                      where TABLE_CASE.CASE_ORIGINATOR2USER=TABLE_USER.OBJID and TABLE_CASE.CASE_STATE2CONDITION=TABLE_CONDITION.OBJID and TABLE_CASE.CASE_PRT2PART_INFO=TABLE_PART_NUM.OBJID
                                                      and TABLE_USER.USER_ACCESS2PRIVCLASS=TABLE_PRIVCLASS.OBJID and TABLE_USER.LOGIN_NAME=? and TABLE_PART_NUM.FAMILY='" + family + "' and TABLE_CONDITION.S_TITLE='CLOSED' and TABLE_CASE.CREATION_TIME &gt; ?", oConn);
  
          FindCases.CommandType = System.Data.CommandType.Text;
          FindCases.Parameters.Add(@"user", OdbcType.Text, 4000).Value = user; //field size 30, text
          //FindCases.Parameters.Add(@"family", OdbcType.Text, 4000).Value = family; //field size 20, text
          FindCases.Parameters.Add(@"date", OdbcType.DateTime, 4000).Value = date;
  </code></pre>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>I did not realize that 'text' wasn't a true type. Changing to NVARCHAR did the trick:</p>
  
  <pre><code>        OdbcCommand FindCases = new OdbcCommand(@"select TABLE_CASE.ID_NUMBER
                                                      from TABLE_CASE, TABLE_USER, TABLE_CONDITION, TABLE_PART_NUM
                                                      where TABLE_CASE.CASE_ORIGINATOR2USER=TABLE_USER.OBJID and TABLE_CASE.CASE_STATE2CONDITION=TABLE_CONDITION.OBJID and TABLE_CASE.CASE_PRT2PART_INFO=TABLE_PART_NUM.OBJID
                                                      and TABLE_USER.LOGIN_NAME=? and TABLE_PART_NUM.FAMILY=? and TABLE_CONDITION.S_TITLE='CLOSED' and TABLE_CASE.CREATION_TIME &gt; ?", oConn);
  
          FindCases.CommandType = System.Data.CommandType.Text;
          FindCases.Parameters.Add(@"user", OdbcType.NVarChar, 30).Value = user; //field size 30, text
          FindCases.Parameters.Add(@"family", OdbcType.NVarChar, 20).Value = family; //field size 20, text
          FindCases.Parameters.Add(@"date", OdbcType.DateTime, 4000).Value = date;
  </code></pre>