Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch for field "xxxx", expecting: Integer actual: Float 1

Status
Not open for further replies.

IMLee

Programmer
Nov 8, 2000
9
0
0
US
Hello,

I am trying to find the source of this error:
'Type mismatch for field "xxxx", expecting: Integer actual: Float'

I have an application that queries an Oracle 8i database from Delphi CS 5 with sp1 running under Windows NT Workstation 4 Sp6a

In the BDE Administrator, the native Oracle driver is configured as
The enable integers entry is true
The Dll32 entry is SQLORA8.DLL
The Vendor Init entry is OCI.dll

This error occurs intermittently.

Anyone who has heard of this error or has any information, please respond.

Thanks
 
IMLee,

Have you formally instantiated any field objects in the data set objects bound to your Oracle tables? If so, have any of the data types changed since then? If so, you may need to delete your previously declared tDield objects and reinstance them.

You may be able to change the type of the tField in question without deleting it first. It takes a little bit of work, but can be done...expecially if you're using Delphi 5's capability to save forms as text files.

(If you're not using Delphi 5, take a look at the convert utility in the BIN\ folder; it will translate DFM's to text files and back.)

I say this because I've only seen this when:

-- I've restructured a table and forgotten to update my field objects.

-- Neglected to use the proper AsDatatype properties when assigning to or reading values from those field objects.

As an example of the latter, I nearly always use something along these lines:

TField1.asInteger := someIntValue;
tField2.asFloat := someFloatValue;
tField1.asInteger := trunc( someInvValue );

Bottom line, something is expecting an integer value but is getting a floating point one instead. Try to determine which object is failing and that should lead you to the real problem in pretty short order.

Hope this helps...

-- Lance
 
Lance,

Thanks for your suggestions.

I should have mentioned that no changes have been made to the previously working program code.

There is an TIntegerField which is receiving a field from a query. The declaration of the field in the database is number (10, 0). It is a known attribute of Oracle that all number fields are stored internally as floats. The automatic conversion of these fields in BDE is governed by settings in the BDE Admin utility under the Configuration/Drivers/Native key. For Oracle 8i to enable the return of integers you must change the entries for DLL32, Vendor Init and enable integers. This much I think is true.

What I suspect, and was hoping another person might have found, is an as yet unknown (to me) setting for telling BDE to REALLY send my aliases that use native Oracle integers even when the underlying datatype is float. Or that something in the Oracle Client Interface is being changed by the all powerful "preventor of information services", the Oracle DBA, who is beyond my reach.

At this point I am ready to code around this by trapping this sometime exception and truncating the returned value in a new assignment statement. This is a last resort because the code I am changing belongs to another.

Thanks again for your reply. I will post any solution I get here.

Ted
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top