Subject Re: [firebird-support] RC7 bug?
Author Helen Borrie
At 09:49 PM 8/12/2003 +0000, you wrote:
>haven't managed to add into bug tracker,

Well, it's not acceptable to post your support problems into the
bugtracker, in any case. That's not what the bugtracker is for.

>so post here (can't say, that
>pasted all needed parts) - problem is with SP_Select_Kolektyvai_Search
>stored procedure: when I use for select * got overflow error during
>data type conversion - conversion error from string "".
>If I write down all fields, there is no overflow

Your "bug" is a matter of syntax. Two things -

1. Column definitions

>CREATE TABLE KOLEKTYVAI (
> "Kolektyvo_ID" PK_TYPE NOT NULL,
> "Pavadinimas" CHAR50 COLLATE UNICODE_FSS,
> "Vadovo1_ID" PK_TYPE_NULL,
> "Vadovo2_ID" PK_TYPE_NULL,
> "Vadovo3_ID" PK_TYPE_NULL,
> "Miestas" CITY_TYPE COLLATE UNICODE_FSS,
> "Salis" COUNTRY_TYPE NOT NULL COLLATE UNICODE_FSS);
>
>CREATE TABLE ZMONES (
> "Zmogaus_ID" PK_TYPE NOT NULL,
> "Vardas" CHAR24 NOT NULL COLLATE UNICODE_FSS,
> "Pavarde" CHAR24 NOT NULL COLLATE UNICODE_FSS,
> "Lytis" BOOL_TYPE NOT NULL,
> "Gimimo_data" DATE_TYPE,
> "Miestas" CHAR24 NOT NULL COLLATE UNICODE_FSS,
> "Salis" COUNTRY_TYPE NOT NULL COLLATE UNICODE_FSS);

Don't specify a COLLATION for unicode_fss columns. It is quite
meaningless, since unicode_fss has only one collation sequence, which is
the default, binary one. You are causing the overflow because, for some
operations, the engine will expect additional bytes for this non-existent
non-binary collation. T

2. You will need to specify the character set in your SP's variable
declarations:

>ALTER PROCEDURE SP_SELECT_KOLEKTYVAI_SEARCH (
> PAVADINIMAS_IN VARCHAR (50))

should be PAVADINIMAS_IN VARCHAR(50) CHARACTER SET UNICODE_FSS

>RETURNS (
> KOLEKTYVO_ID DECIMAL (15, 0),
> PAVADINIMAS VARCHAR (50), <----- and here
> MIESTAS VARCHAR (24), <---- and here
> SALIS VARCHAR (24), <---- and here
> VADOVO1_ID DECIMAL (15, 0),
> VADOVO2_ID DECIMAL (15, 0),
> VADOVO3_ID DECIMAL (15, 0))
>AS
>BEGIN
>/
> for select *
> from KOLEKTYVAI
> where "Pavadinimas" starting with :Pavadinimas_in

Here I think it is probable that the invalid COLLATION attribute that you
attached to the database column affects the "geometry" of the STARTING WITH
argument here.

> into :Kolektyvo_ID , :Pavadinimas, :Miestas, :Salis, :Vadovo1_ID,
>:Vadovo2_ID, :Vadovo3_ID
> do
> SUSPEND;
>END

Is there any reason why you have to use UNICODE_FSS in this database? You
would have better control over things (and more characters for less space)
if you chose a character set that encompasses the languages you have to
store, and used collation sequences for places where you have
language-specific sorting requirements...

/heLen