In the conversion of boolean fields using the Component UniLoader appears the error message: "Cannot convert data for column."
I am using the method LoadFromDataSet.
Could you help me?
UniLoader - Oracle Boolean Fields
-
- Posts: 28
- Joined: Wed 24 Feb 2010 14:08
I need to import a table to oracle using uniloader. When I try to import a Boolean value from the source table is the error "Can not convert data for
column..
The same error occurs when I try to use a TBooleanField with an Oracle Database. With sql server and postgre it works fine, but fail with Oracle.
How can I handle Boolean fields?
column..
The same error occurs when I try to use a TBooleanField with an Oracle Database. With sql server and postgre it works fine, but fail with Oracle.
How can I handle Boolean fields?
Use the code like the following:
You should pay attention to the following.
UniQuery1 is mapped to the DB server supports boolean types (for example, MS SQL BIT), and at design-time you can add persistent fields, and corresponding one will be of the TBooleanField type. In the UniLoader1 you can add columns in the design time too, and the Oracle column corresponds to the TBooleanField will be of the TStringField type. At the same time, this column have be of the type CHAR(1) in the Oracle database, and passed values will be implicitly converted by the Oracle core.
Code: Select all
UniQuery1.SQL.Text := 'select * from test';
UniQuery1.Open;
UniLoader1.LoadFromDataSet(UniQuery1);
UniQuery1 is mapped to the DB server supports boolean types (for example, MS SQL BIT), and at design-time you can add persistent fields, and corresponding one will be of the TBooleanField type. In the UniLoader1 you can add columns in the design time too, and the Oracle column corresponds to the TBooleanField will be of the TStringField type. At the same time, this column have be of the type CHAR(1) in the Oracle database, and passed values will be implicitly converted by the Oracle core.