Subject | Re: [firebird-support] Possible UNION problem in CREATE VIEW |
---|---|
Author | Dimitry Sibiryakov |
Post date | 2009-10-23T19:44:29Z |
> CREATE VIEW INFORMATION_SCHEMA_TABLES ASWhich word in "must specify column name for view select expression"
> SELECT DISTINCT NULL AS TABLE_CATALOG , NULL AS TABLE_SCHEMA ,RDB$RELATION_NAME AS TABLE_NAME, 'BASE TABLE' AS TABLE_TYPE
> FROM RDB$RELATION_FIELDS
> WHERE RDB$SYSTEM_FLAG=0 AND RDB$VIEW_CONTEXT IS NULL
> UNION
> SELECT DISTINCT NULL AS TABLE_CATALOG , NULL AS TABLE_SCHEMA ,RDB$RELATION_NAME AS TABLE_NAME, 'VIEW' AS TABLE_TYPE
> FROM RDB$RELATION_FIELDS
> WHERE RDB$SYSTEM_FLAG=0 AND RDB$VIEW_CONTEXT IS NOT NULL;
>
> The view will fail with the following error:
>
> SQL Error.
> SQL error code = -607.
> Invalid command.
> must specify column name for view select expression.
>
> Interestingly, when I create the view using the syntax upto and immediately before the UNION statement, it works correctly.
>
> Am I missing something, or is there an issue regarding the use of the UNION keyword in the CREATE VIEW statement?
>
> Any help would be greatly apprecaited, as this is driving me nuts.
is not clear to you? Column names must be declared in parentheses right
after view name.
SY, SD.