1
OracleDataAdapter oAdp = new OracleDataAdapter("select * from " + TABLE_NAME, SourceConnStr);
oAdp.Fill(dtTable);

On execution of this code I get the error:

Unsupported Oracle data type 101 encountered.

So I searched about the same and turns out .NET currently doesn't support or identify binary float/double and one of the columns in the table it is referring to; is of the datatype binary double. Please suggest a way to identify if a column of the table is of the datatype binary float/double and cast it to a different datatype like number or varchar which ever is appropriate.

Name           Null     Type          
-------------- -------- -------------       
EMPID          NOT NULL VARCHAR2(20)  
EMPNAME        NOT NULL VARCHAR2(50)  
EMPTYPE        NOT NULL NUMBER(38)    
EMPPHOTO                BINARY_DOUBLE  
DATEOFJOINING           DATE                 
CONTACTNO               VARCHAR2(20)  
6
  • show table structre Mar 29, 2017 at 12:25
  • @MuhammadMuazzam I have just edited the question hope that helps Mar 29, 2017 at 12:33
  • Which DataAcces library are you using? System.Data.OracleClient or Oracle.DataAccess.Client or Oracle.ManagedDataAccess.Client ?
    – Arie
    Mar 29, 2017 at 13:03
  • @Arie System.Data.OracleClient Mar 29, 2017 at 13:09
  • System.Data.OracleClient is deprecated. Since BINARY_DOUBLE and BINARY_FLOAT were added in Oracle Database 10g it is probably not supported.
    – Arie
    Mar 29, 2017 at 13:18

2 Answers 2

2

Which OracleDataAdapter you use ? I guess it's from System.Data.OracleClient.OracleDataAdapter , if you are working with Oracle DB, use ODAC , Oracle.DataAccess.Client.OracleDataAdapter, it works fine with oracle datatypes.

1
  1. Identify structure:

    select * from all_tab_columns where data_type  like 'BINARY%' ;
    
  2. workaround: In your select, replace the column with data conversion using e.g. TO_CHAR:

    new OracleDataAdapter("select column_a, column_b, to_char(column_c_binary_smthg) from " 
        + TABLE_NAME, SourceConnStr);
    
2
  • The problem here is that the user chooses which table to operate on and hence I cannot just randomly convert a single column on assumption. It has to dynamically identify which column is causing the problem and rectify the same Mar 29, 2017 at 12:36
  • Yes, of course. Use same table to list which columns are in TABLE_NAME: "select column_name from all_tab_columns where TABLE_name=" + TABLE_NAME
    – J. Chomel
    Mar 29, 2017 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.