Subject ASCII_CHAR(9)
Author

Hi all, 

Firebird 3, Delphi IBX.

Somehow one of my customers inserted a product code so that at the end of the string he added chr(9) and stored this string in the database. If I try to 

select
    cod_produs
from produse
where
    cod_produs = 'EI20010518' 

I get an empty query

if I do 

select
    cod_produs
from produse
where
    cod_produs starting with 'EI20010518' 
I get the record

if I do 

select
    cod_produs,        -> 'EI20010518'
    char_length(trim(cod_produs))     -> 11 (instead of 10)
from produse
where 
    cod_produs starting with 'EI20010518' 
I get the record


this query :

select
    cod_produs
from produse
where
    cod_produs starting with 'EI20010518' and
    substring(cod_produs from 11 for 1) = ASCII_CHAR(9)

it is true, I get the record. 


My question is : Is there a query, a function, for filtering out these errors ? Someting like : 

update produse
set cod_produs = AnsiOnly(cod_produs)  




Thank you, 

Tiberiu