Subject | Re: [IBO] Real, super Newbie question |
---|---|
Author | Jörg Schiemann |
Post date | 2001-01-05T08:08:28Z |
> > -----Original Message-----*
> > From: Jörg Schiemann [mailto:schimmi@...]
> > Sent: Jueves 4 de Enero de 2001 6:46
> >
> > For some reason IB6 insists to add '.0000000000' to all calculations of
> > barcode when using
> >
> > ( :P_BAR_PREFIX || ( :P_CATEGORY_ID * ( 100000 + :i ) + :i * 10000 + :i
> > 10 + :P_CATEGORY_ID ) ),can't
> >
> > in the SP_GEN_DUMMY_ITEM procedure. I haven't got a clue why why it
> > transforms integers this way, but Jason or Helen might know.
>
> I never have seen SP_GEN_DUMMY_ITEM but if some of the values causes the
> resul to be a numeric with some scale, there's a chance IB will add zeroes
> when converting to string, so maybe a cast to numeric with scale 0 could
> help. Also, I don't know if we are talking about dialect 1 or 3, so I
> say more.It is dialect 1 and the SP is:
>
> C.
>
CREATE PROCEDURE SP_GEN_DUMMY_ITEM(P_CATEGORY_ID INTEGER, P_DESCRIPTION
VARCHAR(50), P_BAR_PREFIX VARCHAR(5), P_COUNT INTEGER) AS
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 think I've to cast P_BAR_PREFIX to an integer like CAST(P_BAR_PREFIX AS
INTEGER) AS BAR_PREFIX
but I don't know how a cast to mumeric with scale 0 looks like.
Can you show me?
TIA
Jörg