IBExpert中SubString函数不可用,找不到原因,所以取不到精确的默认值
SELECT
B.RDB$FIELD_POSITION+1 "序号"
,B.RDB$FIELD_NAME "英文名称"
,(CASE D.RDB$TYPE_NAME
WHEN 'TEXT' THEN 'CHAR' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'LONG' THEN 'INTEGER' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'SHORT' THEN 'SMALLINT' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'DOUBLE' THEN 'DOUBLE PRECISION' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'VARYING' THEN 'VARCHAR' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'FLOAT' THEN 'FLOAT' || '(' || C.RDB$FIELD_LENGTH || ')'
WHEN 'BLOB' THEN 'BLOB'
WHEN 'TIMESTAMP' THEN 'TIMESTAMP'
END) "数据类型"
,B.RDB$DEFAULT_SOURCE "默认值"
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'
AND A.RDB$RELATION_NAME = 'CORPS'
ORDER BY B.RDB$FIELD_POSITION