Subject Re: [firebird-support] Cannot transliterate character between character sets.
Author Tomasz Tyrakowski
On 2013-07-23 09:02, Olaf Kluge wrote:
> In a Table-Field with character set ISO8859_1 there is a record with invalid
> content.[...]
> How can I find simply the wrong record?

Knowing nothing more except what you wrote, I'd suggest some kind of
binary search as a quick solution. Suppose your table has N records. You
iterate as follows (and should find your record in log(N) steps, of
course you put the actual number of records instead of N in the queries):
select * from the_table rows 1 to N/2;
If it fails, your record is in the first half, otherwise it's in the
second one. If the former, do
select * from table rows 1 to N/4;
and if the latter, do
select * from table rows N/2 to 3*N/4;
this will tell you the quarter your record sits in. Then you repeat the
above steps for N/8, N/16 etc., thus narrowing the range containing your
record, until you reach a 1-record range.
I know it might look complicated at first, but it's not. All other
solutions coming to my mind require some programming (at least a stored
procedure) and since you haven't written a program to find the record
yourself, I suppose for some reason you're not able or not allowed to,
so try the binary search.
Another question is, what you're gonna do with the record should you
find it? You won't see it anyway. Maybe instead of binary search based
on record number (in natural table order), you should use some other key
instead, so that you can delete the record once you find the value of
its key?
AFAIR, FlameRobin allows you to retrieve data in chunks (300-records
long by default). Using this feature, you can quickly find the
300-record range and then a 9-step binary search should give you the
exact record.


__--== Tomasz Tyrakowski ==--__
__--== SOL-SYSTEM ==--__
__--== ==--__