Subject | retrieving info for view columns |
---|---|
Author | Michael Apessos |
Post date | 2005-07-04T15:58:21Z |
I'm using the following query to collect information for columns
in a database:
SELECT
T.RDB$RELATION_NAME TABLE_NAME,
F.RDB$FIELD_POSITION FIELD_POSITION,
F.RDB$FIELD_NAME FIELD_NAME,
S.RDB$FIELD_TYPE FIELD_TYPE,
F.RDB$NULL_FLAG NULL_FLAG,
CASE S.RDB$FIELD_TYPE
WHEN 14 THEN S.RDB$CHARACTER_LENGTH
WHEN 37 THEN S.RDB$CHARACTER_LENGTH
WHEN 16 THEN S.RDB$FIELD_PRECISION
ELSE 0
END FIELD_SIZE,
CASE S.RDB$FIELD_TYPE
WHEN 16 THEN -S.RDB$FIELD_SCALE
ELSE 0
END FIELD_DECIMALS
FROM RDB$RELATIONS T
JOIN RDB$RELATION_FIELDS F ON (F.RDB$RELATION_NAME =
T.RDB$RELATION_NAME)
JOIN RDB$FIELDS S ON (F.RDB$FIELD_SOURCE = S.RDB$FIELD_NAME)
WHERE T.RDB$SYSTEM_FLAG=0
ORDER BY 1,2
My problem is when the RELATION is a VIEW. In that case, both
RDB$CHARACTER_LENGTH and RDB$FIELD_PRECISION
from RDB$FIELDS are NULL.
Is there a way to get that information for view columns too?
Thanks in advance
Mike
in a database:
SELECT
T.RDB$RELATION_NAME TABLE_NAME,
F.RDB$FIELD_POSITION FIELD_POSITION,
F.RDB$FIELD_NAME FIELD_NAME,
S.RDB$FIELD_TYPE FIELD_TYPE,
F.RDB$NULL_FLAG NULL_FLAG,
CASE S.RDB$FIELD_TYPE
WHEN 14 THEN S.RDB$CHARACTER_LENGTH
WHEN 37 THEN S.RDB$CHARACTER_LENGTH
WHEN 16 THEN S.RDB$FIELD_PRECISION
ELSE 0
END FIELD_SIZE,
CASE S.RDB$FIELD_TYPE
WHEN 16 THEN -S.RDB$FIELD_SCALE
ELSE 0
END FIELD_DECIMALS
FROM RDB$RELATIONS T
JOIN RDB$RELATION_FIELDS F ON (F.RDB$RELATION_NAME =
T.RDB$RELATION_NAME)
JOIN RDB$FIELDS S ON (F.RDB$FIELD_SOURCE = S.RDB$FIELD_NAME)
WHERE T.RDB$SYSTEM_FLAG=0
ORDER BY 1,2
My problem is when the RELATION is a VIEW. In that case, both
RDB$CHARACTER_LENGTH and RDB$FIELD_PRECISION
from RDB$FIELDS are NULL.
Is there a way to get that information for view columns too?
Thanks in advance
Mike