Subject RE: [firebird-support] When is varchar(10) only 7; arithmetic exception, numeric overflow, or string truncation
Author Rick Debay
I exported the original database as DDL and recreated it. It now works.
Scary, as the database validation tools didn't detect any errors.

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Rick Debay
Sent: Monday, August 27, 2012 5:44 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] When is varchar(10) only 7; arithmetic
exception, numeric overflow, or string truncation

I have a stored procedure that reads from an external file table.
One of the fields is varchar(10) in the stored procedure and char(10) in
the file.
I am selecting from the stored procedure and inserting in to a table
which has a matching varchar(10) COLLATE ISO8859_1 field.
If a field is empty (LTRIM(column)='') the stored procedure returns NULL
for the field.

I get the error 'arithmetic exception, numeric overflow, or string
truncation' if this varchar(10) field is not empty and it is inserted in
to the other table.

I am completely baffled as the table and stored procedure are defined as
varchar(10). There are other fields defined as varchar and they work
fine. If I use STRLEN it says the source field is ten characters. If I
copy the field from the file and put it explicitly in the insert
('62500445 ' ) it fails. If I trim it so that it's only seven
characters it works.

The version of Firebird is "WI-V6.3.6.5026 Firebird 1.5"


------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item on the
main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links