Subject RE: [firebird-support] System table question
Author Thomas Steinmaurer
Hi there,

> I created a stored proc that has a blob defined as so:
> BLOB_IN BLOB SUB_TYPE 1 SEGMENT SIZE 80
>
> I then want to pull in the params from the system tables with the
> following:
>
> select p.rdb$parameter_name,
> p.rdb$parameter_type,
> t.rdb$type_name,
> f.rdb$field_length,
> f.rdb$field_type,
> f.rdb$field_scale,
> f.rdb$field_sub_type,
> f.rdb$field_precision
> from rdb$procedure_parameters p, rdb$fields f, rdb$types t
> where p.rdb$field_source=f.rdb$field_name and
> p.rdb$procedure_name='TEST_PROCEDURE' and
> f.rdb$field_type=t.rdb$type and
> t.rdb$field_name='RDB$FIELD_TYPE'
>
> This gives me all the info I need except for the blob segment size,
> I can't seem to find that one.

RDB$FIELDS.RDB$SEGMENT_LENGTH


> Also wondering why when you have a numeric field it's scale comes
> back as a -2 when it's defined as:
> NUMERIC_IN NUMERIC(15,2)

From the "Firebird Reference Guide" (available on the IBPhoenix CD).

RDB$FIELD_SCALE SMALLINT Stores negative scale for numeric and decimal types: the
power of 10 by which the stored value is multiplied to get
the intended value (for example, 1.234 = 1234 * 10-3).


HTH,
Thomas Steinmaurer
LogManager Serie - Logging/Auditing Suites supporting
InterBase, Firebird, Advantage Database and MS SQL Server
Upscene Productions
http://www.upscene.com