|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I tried
CREATE VIEW v_user_structures_columns AS SELECT table_name, CASE ... END, column_name, app_type, data_length, comments, constraints FROM t_user_structures_columns and I got an error message Dynamic SQL Error -SQL error code = -607 -Invalid command -must specify column name for view select expression Statement failed, SQLCODE = -607 If I tried only the SELECT then it seams to be working OK. any help? Thanks, Andrej. |
|
#2
|
|||
|
|||
|
The error message says it all: you need to supply a name for your case column:
Code:
CREATE VIEW v_user_structures_columns AS SELECT table_name, CASE ... END as the_case_column, column_name, app_type, data_length, comments, constraints FROM t_user_structures_columns |
|
#3
|
|||
|
|||
|
Quote:
Still it doesn't work. I tried this: CREATE VIEW v_user_structures_columns AS SELECT table_name, CASE WHEN (SUBSTR(column_name, 1, 2) = 'C_') THEN SUBSTR(column_name, 3, strlen(column_name) - 3) WHEN (SUBSTR(column_name, 1, 2) = 'R_') THEN SUBSTR(column_name, 3, strlen(column_name) - 3) ELSE column_name END as app_column_name, column_name, app_type, data_length, comments, constraints FROM t_user_structures_columns; with the same error message. but this is working fine. CREATE VIEW v_user_structures_columns (table_name, app_column_name, column_name, app_type, data_length, comments, constraints) AS SELECT table_name, CASE WHEN (SUBSTR(column_name, 1, 2) = 'C_') THEN SUBSTR(column_name, 3, strlen(column_name) - 3) WHEN (SUBSTR(column_name, 1, 2) = 'R_') THEN SUBSTR(column_name, 3, strlen(column_name) - 3) ELSE column_name END, column_name, app_type, data_length, comments, constraints FROM t_user_structures_columns; |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > How do I create VIEW with CASE |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|