Subject Re: [firebird-support] Overflow occured during datatype conversion. Conversion error from string "BLOB"
Author Aage Johansen
zzotnik wrote:
> Hi guys,
>
> I keep getting the error in the subject line with my stored
> procedure. Here is the code, hope you guys can help me work out
> something :-)
>
> CREATE TABLE INVOICES (
> INVOICEID INTEGER NOT NULL,
> CUSTOMERNAME BLOB SUB_TYPE 1 CHARACTER SET ISO8859_2 NOT NULL
> COLLATE ISO8859_2,
> CUSTOMERPCODE BLOB SUB_TYPE 1 CHARACTER SET ISO8859_2 NOT NULL
> COLLATE ISO8859_2,
> CUSTOMERCITY BLOB SUB_TYPE 1 CHARACTER SET ISO8859_2 NOT NULL
> COLLATE ISO8859_2,
> CUSTOMERADDRESS BLOB SUB_TYPE 1 CHARACTER SET ISO8859_2 NOT NULL
> COLLATE ISO8859_2);
>
>
> CREATE PROCEDURE LOAD_INVOICE_LIST
> RETURNS(
> INVOICEID INTEGER,
> CUSTOMERNAME BLOB SUB_TYPE 1 SEGMENT SIZE 1 CHARACTER SET
> ISO8859_2,
> CUSTOMERPCODE BLOB SUB_TYPE 1 SEGMENT SIZE 1 CHARACTER SET
> ISO8859_2,
> CUSTOMERCITY BLOB SUB_TYPE 1 SEGMENT SIZE 1 CHARACTER SET
> ISO8859_2,
> CUSTOMERADDRESS BLOB SUB_TYPE 1 SEGMENT SIZE 1 CHARACTER SET
> ISO8859_2,
> NETSUM DECIMAL(18, 2),
> VATSUM DECIMAL(18, 2),
> TOTALSUM DECIMAL(18, 2))
> AS
> BEGIN
> FOR SELECT I.InvoiceID, I.CustomerName, I.CustomerPCode,
> I.CustomerCity, I.CustomerAddress, Sum(II.ItemNetPrice *
> II.Quantity),
> Sum(II.ItemNetPrice * II.Quantity * II.VATPercentage / 100)
> FROM Invoices I JOIN InvoiceItems II ON I.InvoiceID = II.InvoiceID
> GROUP BY 1, 2, 3, 4, 5
> INTO :InvoiceID, :CustomerName,
> :CustomerPCode, :CustomerCity, :CustomerAddress, :NetSum, :VATSum
> DO BEGIN
> TotalSum = :NetSum + :VATSum;
> SUSPEND;
> END
> END;
>
> The problem occurs when I try to execute LOAD_INVOICE_LIST.
>

I think "group by" (or sorting) on blob fields may be
allowed/disallowed/fail depending on Firebird version.
Review Slavomir's suggestion so that grouping is done on varchar (not
blob fields). If this doesn't help, ask again and state your
Firebird version and other relevant info.

--
Aage J.