Subject IBO's basic tutorials
Author Jörg Schiemann
Hi,

As a new IBO user I'am testing the basic tutorial which follows with
IBObjects.
Already with tutorial1 the trouble begins. :-(
I'm using Interbase 6.0

I noticed that the procedure SP_GEN_DUMMY_ITEM doesn't work.
Here is the procedure:

DECLARE VARIABLE i INTEGER;
BEGIN
i = 1;
WHILE ( i <= :P_COUNT ) DO BEGIN
INSERT INTO ITEM(ID_CATEGORY, DESCRIPTION, BARCODE, COST_PRICE,
CURR_VALUE)
VALUES( :P_CATEGORY_ID,
( :P_DESCRIPTION || ' ' || :i ),
( :P_BAR_PREFIX || ( :P_CATEGORY_ID * ( 100000 + :i ) + :i *
10000 + :i * 10 + :P_CATEGORY_ID ) ),
( :i * 121 + :P_CATEGORY_ID * 10 + :i ),
( :i * 59 ) );
i = i + 1;
END /* WHILE */
END


I've got the errormessage:

ISC ERROR CODE:335544321
ISC ERROR MESSAGE:
arithmetic exception, numeric overflow, or string truncation
STATEMENT:
TIB_DSQL: "IB_Script."

SQL ERROR CODE:-802
SQL ERROR MESSAGE:
Arithmetic overflow or division by zero has occurred.


After I changed the procedure to:

DECLARE VARIABLE i INTEGER;
DECLARE VARIABLE b INTEGER;
BEGIN
i = 1;
WHILE ( i <= :P_COUNT ) DO BEGIN
b = ( :P_CATEGORY_ID * ( 100000 + :i ) + :i * 10000 + :i * 10 +
:P_CATEGORY_ID );
INSERT INTO ITEM(ID_CATEGORY, DESCRIPTION, BARCODE, COST_PRICE,
CURR_VALUE)
VALUES( :P_CATEGORY_ID,
( :P_DESCRIPTION || ' ' || :i ),
( :P_BAR_PREFIX || :b || :i ),
( :i * 121 + :P_CATEGORY_ID * 10 + :i ),
( :i * 59 ) );
i = i + 1;
END /* WHILE */
END

it works.

I don't know if it's only me who had the problem.
Neither do I understand why the error occurs.

Could someone else test it?

Regards,
Jörg Schiemann