Subject RE: [firebird-support] Stored Procedure Creator Problem
Author Alan McDonald
> I found a SQL String which brings me all the tables and columns
> within the Database.
>
> SELECT
> a.RDB$RELATION_NAME, b.RDB$FIELD_NAME, b.RDB$FIELD_ID,
> d.RDB$TYPE_NAME, c.RDB$FIELD_LENGTH, c.RDB$FIELD_SCALE
> FROM
> RDB$RELATIONS a
> INNER JOIN RDB$RELATION_FIELDS b ON a.RDB$RELATION_NAME =
> b.RDB$RELATION_NAME
> INNER JOIN RDB$FIELDS c ON b.RDB$FIELD_SOURCE = c.RDB$FIELD_NAME
> INNER JOIN RDB$TYPES d ON c.RDB$FIELD_TYPE = d.RDB$TYPE
> WHERE
> a.RDB$SYSTEM_FLAG = 0 AND d.RDB$FIELD_NAME = 'RDB$FIELD_TYPE'
> ORDER BY a.RDB$RELATION_NAME, b.RDB$FIELD_ID
>
> But the problem is that the RDB$TYPE_NAME and RDB$FIELD_LENGTH is
> quite different from what is shown in the Firebird GUI I use. There, it
> shows varchar, integer, etc and when I run the SQL Script it shows
> varying, long, text, int64, etc.
>
> So, does anyone knows how to convert these types shown when i run
> the SQL Script to the types shown in the Firebird GUI?
>
> Thanks
>
> Leonardo Nakahara de Oliveira

The Types to which refer are not all FIELD_TYPES. To see which of these are
FIELD_TYPES, look in the
RDB$FIELDS table. If you are returning more than (SELECT DISTICT
RBD$FIELD_TYPE FROM RDB$FIELDS) then I think your unions are not constructed
correctly for the list of columns in your tables.
Alan