Subject | Re: [ib-support] variable not updating in SP |
---|---|
Author | Svein Erling Tysvær |
Post date | 2002-05-16T08:33:05Z |
Andrew,
rdb$index_name in the where-clause of the subselect is considered to belong
to rdb$index_segments and not rdb$indices.
I would recommend changing to
SELECT RDB$FIELD_NAME
FROM RDB$INDEX_SEGMENTS RS
WHERE (RS.RDB$INDEX_NAME STARTING WITH 'RDB$PRIMARY')
AND EXISTS(SELECT 1 FROM RDB$INDEXNAME RI
WHERE (rI.RDB$INDEX_NAME = RS.RDB$INDEX_NAME)
AND (RI.RDB$RELATION_NAME = :VAR_TABLENAME)
)
INTO :VAR_PKNAME;
but it would be interesting to see if it was enough to qualify your fields.
Set
-not quite Andrew in signing my messages
> SELECT RDB$FIELD_NAMEMy guess is that this for some reason is considered ambiguous. Maybe
> FROM RDB$INDEX_SEGMENTS
> WHERE RDB$INDEX_NAME =
> (
> SELECT RDB$INDEX_NAME
> FROM RDB$INDICES
> WHERE (RDB$INDEX_NAME STARTING WITH 'RDB$PRIMARY')
> AND (RDB$RELATION_NAME = :VAR_TABLENAME)
> )
> INTO :VAR_PKNAME;
rdb$index_name in the where-clause of the subselect is considered to belong
to rdb$index_segments and not rdb$indices.
I would recommend changing to
SELECT RDB$FIELD_NAME
FROM RDB$INDEX_SEGMENTS RS
WHERE (RS.RDB$INDEX_NAME STARTING WITH 'RDB$PRIMARY')
AND EXISTS(SELECT 1 FROM RDB$INDEXNAME RI
WHERE (rI.RDB$INDEX_NAME = RS.RDB$INDEX_NAME)
AND (RI.RDB$RELATION_NAME = :VAR_TABLENAME)
)
INTO :VAR_PKNAME;
but it would be interesting to see if it was enough to qualify your fields.
Set
-not quite Andrew in signing my messages