Subject TIBOQuery.Locate
Author Sergey Kanovka
IBO 4.2.Id, Firebird 1.0.2.908, Delphi 7

I have a strange error when I try to locate a record in TIBOQuery. SQL
is pretty simple:

SELECT PERSON_ID
, FIRST_NAME
, LAST_NAME
, MI
, SSN
FROM PERSONS
order by last_name
for update

Delphi code:

PersonsQry.Open;
PersonsQry.Locate( 'SSN', Trim( SSNEdit.Text ), [] );

After Locate I get following error:

Token unknown
_NAME


Here is some info from monitor:
================================
/*---
[ 4/22/2003 5:14:15 PM ]
PREPARE STATEMENT
TR_HANDLE = 13334504
STMT_HANDLE = 13340380

SELECT PERSON_ID
, FIRST_NAME
, LAST_NAME
, MI
, SSN
FROM PERSONS
ORDER BY last_name ASC


PLAN SORT ((PERSONS NATURAL))

FIELDS = [ Version 1 SQLd 5 SQLn 30
PERSONS.PERSON_ID[PERSON_ID] = <NIL>
PERSONS.FIRST_NAME[FIRST_NAME] = <NIL>
PERSONS.LAST_NAME[LAST_NAME] = <NIL>
PERSONS.MI[MI] = <NIL>
PERSONS.SSN[SSN] = <NIL> ]
----*/

/*---
[ 4/22/2003 5:14:15 PM ]
FETCH
STMT_HANDLE = 13340380
FIELDS = [ Version 1 SQLd 5 SQLn 5
PERSONS.PERSON_ID[PERSON_ID] = 0
PERSONS.FIRST_NAME[FIRST_NAME] = ''
PERSONS.LAST_NAME[LAST_NAME] = ''
PERSONS.MI[MI] = ''
PERSONS.SSN[SSN] = '' ]

ERRCODE = 100
----*/

/*---
[ 4/22/2003 5:14:17 PM ]
PREPARE STATEMENT
TR_HANDLE = 13334504
STMT_HANDLE = 13333568

SELECT First _NAME PERSON_ID
FROM PERSONS
WHERE (((SSN = ? /* LOC_4 */ )))

FIELDS = [ Version 1 SQLd 5 SQLn 30
PERSONS.PERSON_ID[PERSON_ID] = <NIL>
PERSONS.FIRST_NAME[FIRST_NAME] = <NIL>
PERSONS.LAST_NAME[LAST_NAME] = <NIL>
PERSONS.MI[MI] = <NIL>
PERSONS.SSN[SSN] = <NIL> ]

SECONDS = 0.015

ERRCODE = 335544569
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
PREPARE STATEMENT
TR_HANDLE = 13334504
STMT_HANDLE = 13333568

SELECT First _NAME PERSON_ID
FROM PERSONS
WHERE (((SSN = ? /* PRM_0 */ )))

FIELDS = [ Version 1 SQLd 5 SQLn 30
PERSONS.PERSON_ID[PERSON_ID] = <NIL>
PERSONS.FIRST_NAME[FIRST_NAME] = <NIL>
PERSONS.LAST_NAME[LAST_NAME] = <NIL>
PERSONS.MI[MI] = <NIL>
PERSONS.SSN[SSN] = <NIL> ]

ERRCODE = 335544569
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
INTERPRETE BUFFER =

ERRCODE = 17
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
INTERPRETE BUFFER = Dynamic SQL Error

ERRCODE = 21
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
INTERPRETE BUFFER = SQL error code = -104

ERRCODE = 31
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
INTERPRETE BUFFER = Token unknown - line 1, char 14

ERRCODE = 5
----*/
/*---
[ 4/22/2003 5:14:17 PM ]
INTERPRETE BUFFER = _NAME

ERRCODE = -1
----*/
=================================

I see that internal dataset forms strange SQL:
SELECT First _NAME PERSON_ID
FROM PERSONS
WHERE (((SSN = ? /* LOC_4 */ )))

which probably caused an error.

Any ideas?

Thanks,
Serge