problem inserting large integer into a database - help 
Author Message
 problem inserting large integer into a database - help

Hello,

I am trying to enter a barcode number which is 15 digits long into a
database using ODBCConnect and session. However if I try and enter a
number of more than 9 digits I get an error message.

I would appreciate any pointers.

The following is the error stack:

'Unhandled exception: Improper store into indexable object'
UninterpretedBytes(Object)>>error:
UninterpretedBytes(Object)>>improperStoreError
UninterpretedBytes(Object)>>basicAt:put:
UninterpretedBytes>>byteAt:put:
UninterpretedBytes>>longAt:put:bigEndian:
UninterpretedBytes>>longAt:put:
ODBCBuffer>>at:putInteger:
ODBCBuffer>>at:put:
ODBCBuffer(ExternalDatabaseBuffer)>>value:
ODBCBuffer>>bindForInput
ODBCSession>>bindValue:at:
ODBCSession>>bindExternal
optimized [] in ExternalDatabaseSession>>execute
etc
etc



Fri, 13 Aug 2004 02:10:26 GMT  
 problem inserting large integer into a database - help
May sound as a stupid question, but have you checked the size of the
field in your DB? Isn't it by a change Number[9]? What is the field
definition in the image?

- Jaroslaw.

Quote:

> Hello,

> I am trying to enter a barcode number which is 15 digits long into a
> database using ODBCConnect and session. However if I try and enter a
> number of more than 9 digits I get an error message.

> I would appreciate any pointers.

> The following is the error stack:

> 'Unhandled exception: Improper store into indexable object'
> UninterpretedBytes(Object)>>error:
> UninterpretedBytes(Object)>>improperStoreError
> UninterpretedBytes(Object)>>basicAt:put:
> UninterpretedBytes>>byteAt:put:
> UninterpretedBytes>>longAt:put:bigEndian:
> UninterpretedBytes>>longAt:put:
> ODBCBuffer>>at:putInteger:
> ODBCBuffer>>at:put:
> ODBCBuffer(ExternalDatabaseBuffer)>>value:
> ODBCBuffer>>bindForInput
> ODBCSession>>bindValue:at:
> ODBCSession>>bindExternal
> optimized [] in ExternalDatabaseSession>>execute
> etc
> etc



Fri, 13 Aug 2004 04:36:47 GMT  
 problem inserting large integer into a database - help
Here's a recommendation.  Don't use a Number.  Only use numbers on fields
that you will perform math on.  Use strings otherwise, this will help you
in many ways.  I never use numbers for zipcodes, phone numbers, or bar
codes.
Quote:

> May sound as a stupid question, but have you checked the size of the
> field in your DB? Isn't it by a change Number[9]? What is the field
> definition in the image?

> - Jaroslaw.


> > Hello,

> > I am trying to enter a barcode number which is 15 digits long into a
> > database using ODBCConnect and session. However if I try and enter a
> > number of more than 9 digits I get an error message.

> > I would appreciate any pointers.

> > The following is the error stack:

> > 'Unhandled exception: Improper store into indexable object'
> > UninterpretedBytes(Object)>>error:
> > UninterpretedBytes(Object)>>improperStoreError
> > UninterpretedBytes(Object)>>basicAt:put:
> > UninterpretedBytes>>byteAt:put:
> > UninterpretedBytes>>longAt:put:bigEndian:
> > UninterpretedBytes>>longAt:put:
> > ODBCBuffer>>at:putInteger:
> > ODBCBuffer>>at:put:
> > ODBCBuffer(ExternalDatabaseBuffer)>>value:
> > ODBCBuffer>>bindForInput
> > ODBCSession>>bindValue:at:
> > ODBCSession>>bindExternal
> > optimized [] in ExternalDatabaseSession>>execute
> > etc
> > etc



Fri, 13 Aug 2004 06:41:24 GMT  
 problem inserting large integer into a database - help

Quote:

> Here's a recommendation.  Don't use a Number.  Only use numbers on fields
> that you will perform math on.  Use strings otherwise, this will help you
> in many ways.  I never use numbers for zipcodes, phone numbers, or bar
> codes.

I have never written an application involving bar codes but there is
one general thing to remember about numbers represented as string:
both representations sort differently.
In the context of Chris's answer - sorting is also a mathematics
operation, so this is just a clarification :-).
One can get around the problem in queries but indexing will never work
properly if you want to use range operation (<,>, etc.).

Regards, Jaroslaw.

Quote:

> > May sound as a stupid question, but have you checked the size of the
> > field in your DB? Isn't it by a change Number[9]? What is the field
> > definition in the image?

> > - Jaroslaw.


> > > Hello,

> > > I am trying to enter a barcode number which is 15 digits long into a
> > > database using ODBCConnect and session. However if I try and enter a
> > > number of more than 9 digits I get an error message.



Fri, 13 Aug 2004 18:44:07 GMT  
 problem inserting large integer into a database - help

Quote:


> > Here's a recommendation.  Don't use a Number.  Only use numbers on fields
> > that you will perform math on.  Use strings otherwise, this will help you
> > in many ways.  I never use numbers for zipcodes, phone numbers, or bar
> > codes.

> I have never written an application involving bar codes but there is
> one general thing to remember about numbers represented as string:
> both representations sort differently.
> In the context of Chris's answer - sorting is also a mathematics
> operation, so this is just a clarification :-).
> One can get around the problem in queries but indexing will never work
> properly if you want to use range operation (<,>, etc.).

Well for starters doing a range search on a bar code would probably be somewhat unusual.  Also
many bar codes are fixed length in their usage and this makes the sort problem go away.
Further more they can often be padded to the maximum length.  Again the issue goes away.


Fri, 13 Aug 2004 22:18:05 GMT  
 problem inserting large integer into a database - help

Quote:

> Hello,

> I am trying to enter a barcode number which is 15 digits long into a
> database using ODBCConnect and session. However if I try and enter a
> number of more than 9 digits I get an error message.

> I would appreciate any pointers.

> The following is the error stack:

> 'Unhandled exception: Improper store into indexable object'
> UninterpretedBytes(Object)>>error:
> UninterpretedBytes(Object)>>improperStoreError
> UninterpretedBytes(Object)>>basicAt:put:
> UninterpretedBytes>>byteAt:put:
> UninterpretedBytes>>longAt:put:bigEndian:
> UninterpretedBytes>>longAt:put:
> ODBCBuffer>>at:putInteger:
> ODBCBuffer>>at:put:
> ODBCBuffer(ExternalDatabaseBuffer)>>value:
> ODBCBuffer>>bindForInput
> ODBCSession>>bindValue:at:
> ODBCSession>>bindExternal
> optimized [] in ExternalDatabaseSession>>execute

The problem is quite simple and not realy obvious.
In most databases (except Oracle) you have several
numeric types. For this different types you have different
Classes in Smalltalk.

When saving integer into a database using ODBC it is
assumed that it is save in an INTEGER field which only
holds 32bit integers.

If you want to save 15 digits integer you have to use
a numeric field (This is equal to NUMBER in Oracle). This
type can hold numeric values up to 39 digits (including
the number of digits after the decimal point). Therefore
the correct class in Smalltalk is FixedPoint.

If you define the field in the database as numeric (or
NUMBER in Oracle) and convert the barcode into a FixedPoint
before saving it then it will work.

This is a nice example where a typsystem can bite you even
using Smalltalk.

Greetings

    Clemens Hoffmann
    IT-Consultant
    www.heeg.de



Sat, 14 Aug 2004 17:10:34 GMT  
 problem inserting large integer into a database - help
Bar codes can also potentially start with zero, in which case they will get
truncated in interesting ways if you store them as numbers.


Quote:
> Here's a recommendation.  Don't use a Number.  Only use numbers on fields
> that you will perform math on.  Use strings otherwise, this will help you
> in many ways.  I never use numbers for zipcodes, phone numbers, or bar
> codes.


>> May sound as a stupid question, but have you checked the size of the
>> field in your DB? Isn't it by a change Number[9]? What is the field
>> definition in the image?

>> - Jaroslaw.


>> > Hello,

>> > I am trying to enter a barcode number which is 15 digits long into a
>> > database using ODBCConnect and session. However if I try and enter a
>> > number of more than 9 digits I get an error message.

>> > I would appreciate any pointers.

>> > The following is the error stack:

>> > 'Unhandled exception: Improper store into indexable object'
>> > UninterpretedBytes(Object)>>error:
>> > UninterpretedBytes(Object)>>improperStoreError
>> > UninterpretedBytes(Object)>>basicAt:put:
>> > UninterpretedBytes>>byteAt:put:
>> > UninterpretedBytes>>longAt:put:bigEndian:
>> > UninterpretedBytes>>longAt:put:
>> > ODBCBuffer>>at:putInteger:
>> > ODBCBuffer>>at:put:
>> > ODBCBuffer(ExternalDatabaseBuffer)>>value:
>> > ODBCBuffer>>bindForInput
>> > ODBCSession>>bindValue:at:
>> > ODBCSession>>bindExternal
>> > optimized [] in ExternalDatabaseSession>>execute etc etc



Sun, 15 Aug 2004 08:38:05 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Build Problem-- OverflowError: integer literal too large

2. Help! Integer value too large

3. Strange Problem: integer value too large to represent.

4. Help in reading MP3v2 data and inserting in Clarion Database

5. Problem inserting into Postgres (PgSQL) database

6. help - inserting values into database tables

7. Filter problem with larger database

8. Performance problem with large database

9. Newbie: Working with large database -- help!

10. Large .DBF/Large NTX Key Length Indexing Problem

11. inserting integer in Table

12. insert large BLOB - MySQL

 

 
Powered by phpBB® Forum Software