Subject Corupting fields from simple SP
Author Tim Gahnström
I am running FB 1.5 on windows and have run into a strange problem that I cannot seem to wrap my head around.

I have a simple table with a few fields

CREATE TABLE T_TRANSACTION_ROW_CONTENT (
TRANSACTION_ROW_ID INTEGER NOT NULL,
ITEM_ID INTEGER,
IRFID INTEGER,
DELIVERED_DATE TIMESTAMP,
ITRANSACTION_ID INTEGER,
TRANSACTION_ROW_CONTENT_ID INTEGER NOT NULL,
STATUS VARCHAR(10)
);

It only containes a few lines of simple data (integers in all fields except DELIVERED_DATE and STATUS who are NULL).

When I try to run this simple command

update t_transaction_row_content trc
set status='w'
where trc.transaction_row_content_id = 6

I get this error:

Overflow occurred during data type conversion.
conversion error from string "w".

Despie the fact that STATUS is obviously a varchar and should accept a string without a problem.

The problem doesn't apear imediatley and in this late hour I have not been able to pinpoint excactly what I need to do to corrupt the table but a (pretty) safe way appears to be to run this SP.


CREATE PROCEDURE SP_SET_DISC_DELIVERED (
SRFID CHAR(16),
STATUS VARCHAR(10))
AS
DECLARE VARIABLE IRFID_V INTEGER;
DECLARE VARIABLE TRANSACTION_ROW_CONTENT_ID_V INTEGER;
DECLARE VARIABLE DELIVERED_DATE_V TIMESTAMP;
begin
select irfid from t_products_rfid where rfid = :srfid into :irfid_v ;

select first 1 TRANSACTION_ROW_CONTENT_ID
from t_transaction_row_content trc
where :irfid_v=irfid
order by transaction_row_id desc
into :transaction_row_content_id_v;

if (:STATUS = 'DELIVERED') then
delivered_date_v='NOW';
else
delivered_date_v=null;

update t_transaction_row_content trc
set delivered_date = :delivered_date_v,
trc.status = status
where transaction_row_content_id = :transaction_row_content_id_v;

update t_products_rfid tpr
set tpr.status='OUT'
where tpr.rfid=:SRFID;
End


I have been banging my head against this problem for many hours now and any ideas would be much apreciated because I am stomped. I have tried to recreate the DB from nothing to be sure that there are no eroneous initial data but no success there.


Thanks a lot in advance.

Tim