Subject RE: [firebird-support] No current record for fetch operation
Author RB Smissaert
Sorry the bottom of that mail should be ignored.



RBS



_____

From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of RB Smissaert
Sent: 24 September 2008 22:54
To: firebird-support@yahoogroups.com
Subject: [firebird-support] No current record for fetch operation



Using FB 1.5 and some users get the error:

No current record for fetch operation

When running this query:

SELECT

R.RDB$RELATION_ID,

RF.RDB$RELATION_NAME,

RF.RDB$FIELD_NAME,

T.RDB$TYPE_NAME,

RF.RDB$FIELD_POSITION,

F.RDB$FIELD_LENGTH,

RF.RDB$SYSTEM_FLAG

FROM

RDB$RELATION_FIELDS RF

LEFT JOIN RDB$FIELDS F ON (RF.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME)

INNER JOIN

RDB$TYPES T ON (F.RDB$FIELD_TYPE = T.RDB$TYPE) INNER JOIN

RDB$RELATIONS R ON (RF.RDB$RELATION_NAME = R.RDB$RELATION_NAME)

WHERE

T.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'

I understand that this can be caused by FB having problems with the left
join before the inner joins and the solution should be

to re-write the SQL, so the left join comes after all inner joins. The
trouble is that I can't do that in the above SQL.

Would changing the left join to a right join always avoid this problem?

SELECT

R.RDB$RELATION_ID,

RF.RDB$RELATION_NAME,

RF.RDB$FIELD_NAME,

T.RDB$TYPE_NAME,

RF.RDB$FIELD_POSITION,

F.RDB$FIELD_LENGTH,

RF.RDB$SYSTEM_FLAG

FROM

RDB$FIELDS F

RIGHT JOIN

RDB$RELATION_FIELDS RF ON (F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE)

INNER JOIN

RDB$TYPES T ON (F.RDB$FIELD_TYPE = T.RDB$TYPE) INNER JOIN

RDB$RELATIONS R ON (RF.RDB$RELATION_NAME = R.RDB$RELATION_NAME)

WHERE

T.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'








RBS






[Non-text portions of this message have been removed]