Subject RE: [firebird-support] Re: using case, coalesce... in fb 1.5 views
Author Thomas Steinmaurer
> > Show us the DDL statement of your view, and we might be
> > able to help.
> I create simple table:
> CREATE TABLE A
> (B INTEGER);
>
> Then I try with simple select with use of case, which work fine:
> SELECT
> (CASE WHEN b is null
> THEn 2
> ELSE 0
> END) as myfield
> FROM a
>
> Then I try same with view:
> CREATE VIEW my_view
> AS
> SELECT
> (CASE WHEN b is null
> THEn 2
> ELSE 0
> END) as myfield
> FROM a
>
> ... and get error. (Dynamic SQL Error SQL error code = -607 Invalid
> command must specify column name for view select expression).

Because the above isn't a valid view definition.

Try:

CREATE VIEW my_view
myfield
AS
SELECT
(CASE WHEN b is null THEN 2 ELSE 0 END)
FROM a;


HTH,
Thomas Steinmaurer

The IB LogManager Product Family
Logging/Auditing Suite for InterBase and Firebird
http://www.iblogmanager.com