Subject | Error creating view |
---|---|
Author | Thomas Miller |
Post date | 2002-09-26T20:17:06Z |
We use literals in views all the time and have to cast them to the
appropriate type.
For some reason this doesn't work with this view.
I get this error:
"SQL Runner Error
ISC ERROR CODE:335544569
ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code=-104
Invalid command
Data type unknown"
When I try to run this view script:
CREATE VIEW BSS_CONTROL_RPT_V
(BSS_MODULE ,
USER_ID ,
CONTROL_NO ,
FIELD_DESC ,
ALPHA_NUM ,
BSS_PROC ,
INT_NUM ,
FLOAT_NUM ,
DATE_1 ,
DATE_2 )
AS SELECT
BSS_CONTROL.BSS_MODULE ,
CAST('!SYSTEM DEFAULT!' AS CHAR(40)),
BSS_CONTROL.CONTROL_NO ,
BSS_CONTROL.FIELD_DESC ,
BSS_CONTROL.ALPHA_NUM ,
BSS_CONTROL.BSS_PROC ,
BSS_CONTROL.INT_NUM ,
BSS_CONTROL.FLOAT_NUM ,
BSS_CONTROL.DATE_1 ,
BSS_CONTROL.DATE_2
FROM
BSS_CONTROL
UNION ALL
SELECT
BSS_USER_CONTROL.BSS_MODULE ,
BSS_USER_CONTROL.USER_ID ,
BSS_USER_CONTROL.CONTROL_NO ,
BSS_USER_CONTROL.FIELD_DESC ,
BSS_USER_CONTROL.ALPHA_NUM ,
BSS_USER_CONTROL.BSS_PROC ,
BSS_USER_CONTROL.INT_NUM ,
BSS_USER_CONTROL.FLOAT_NUM ,
BSS_USER_CONTROL.DATE_1 ,
BSS_USER_CONTROL.DATE_2
FROM
BSS_USER_CONTROL;
_______________________________________________________
Based on these two tables:
CREATE TABLE BSS_CONTROL (
BSS_MODULE VARCHAR(5) NOT NULL,
CONTROL_NO NUMERIC(5,0) NOT NULL,
FIELD_DESC VARCHAR(255),
ALPHA_NUM VARCHAR(120),
BSS_PROC VARCHAR(1),
INT_NUM NUMERIC(15,0),
FLOAT_NUM NUMERIC(18,6),
DATE_1 TIMESTAMP,
DATE_2 TIMESTAMP)
;
CREATE UNIQUE INDEX BSS_CONTROL_PK
ON BSS_CONTROL (BSS_MODULE, CONTROL_NO)
;
ALTER TABLE BSS_CONTROL
ADD CONSTRAINT BSS_CONTROL_PK PRIMARY KEY (BSS_MODULE, CONTROL_NO)
;
CREATE TABLE BSS_USER_CONTROL (
BSS_MODULE VARCHAR(5) NOT NULL,
USER_ID VARCHAR(40) DEFAULT 'SYSTEMDEFAULTSETTINGS' NOT
NULL,
CONTROL_NO NUMERIC(5,0) NOT NULL,
FIELD_DESC VARCHAR(255),
ALPHA_NUM VARCHAR(120),
BSS_PROC VARCHAR(1),
INT_NUM NUMERIC(15,0),
FLOAT_NUM NUMERIC(18,6),
DATE_1 TIMESTAMP,
DATE_2 TIMESTAMP)
;
CREATE UNIQUE INDEX BSS_USER_CONTROL_PK
ON BSS_USER_CONTROL (BSS_MODULE, USER_ID, CONTROL_NO)
;
ALTER TABLE BSS_USER_CONTROL
ADD CONSTRAINT BSS_USER_CONTROL_PK PRIMARY KEY (BSS_MODULE, USER_ID,
CONTROL_NO)
;
--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork
http://www.bss-software.com
[Non-text portions of this message have been removed]
appropriate type.
For some reason this doesn't work with this view.
I get this error:
"SQL Runner Error
ISC ERROR CODE:335544569
ISC ERROR MESSAGE:
Dynamic SQL Error
SQL error code=-104
Invalid command
Data type unknown"
When I try to run this view script:
CREATE VIEW BSS_CONTROL_RPT_V
(BSS_MODULE ,
USER_ID ,
CONTROL_NO ,
FIELD_DESC ,
ALPHA_NUM ,
BSS_PROC ,
INT_NUM ,
FLOAT_NUM ,
DATE_1 ,
DATE_2 )
AS SELECT
BSS_CONTROL.BSS_MODULE ,
CAST('!SYSTEM DEFAULT!' AS CHAR(40)),
BSS_CONTROL.CONTROL_NO ,
BSS_CONTROL.FIELD_DESC ,
BSS_CONTROL.ALPHA_NUM ,
BSS_CONTROL.BSS_PROC ,
BSS_CONTROL.INT_NUM ,
BSS_CONTROL.FLOAT_NUM ,
BSS_CONTROL.DATE_1 ,
BSS_CONTROL.DATE_2
FROM
BSS_CONTROL
UNION ALL
SELECT
BSS_USER_CONTROL.BSS_MODULE ,
BSS_USER_CONTROL.USER_ID ,
BSS_USER_CONTROL.CONTROL_NO ,
BSS_USER_CONTROL.FIELD_DESC ,
BSS_USER_CONTROL.ALPHA_NUM ,
BSS_USER_CONTROL.BSS_PROC ,
BSS_USER_CONTROL.INT_NUM ,
BSS_USER_CONTROL.FLOAT_NUM ,
BSS_USER_CONTROL.DATE_1 ,
BSS_USER_CONTROL.DATE_2
FROM
BSS_USER_CONTROL;
_______________________________________________________
Based on these two tables:
CREATE TABLE BSS_CONTROL (
BSS_MODULE VARCHAR(5) NOT NULL,
CONTROL_NO NUMERIC(5,0) NOT NULL,
FIELD_DESC VARCHAR(255),
ALPHA_NUM VARCHAR(120),
BSS_PROC VARCHAR(1),
INT_NUM NUMERIC(15,0),
FLOAT_NUM NUMERIC(18,6),
DATE_1 TIMESTAMP,
DATE_2 TIMESTAMP)
;
CREATE UNIQUE INDEX BSS_CONTROL_PK
ON BSS_CONTROL (BSS_MODULE, CONTROL_NO)
;
ALTER TABLE BSS_CONTROL
ADD CONSTRAINT BSS_CONTROL_PK PRIMARY KEY (BSS_MODULE, CONTROL_NO)
;
CREATE TABLE BSS_USER_CONTROL (
BSS_MODULE VARCHAR(5) NOT NULL,
USER_ID VARCHAR(40) DEFAULT 'SYSTEMDEFAULTSETTINGS' NOT
NULL,
CONTROL_NO NUMERIC(5,0) NOT NULL,
FIELD_DESC VARCHAR(255),
ALPHA_NUM VARCHAR(120),
BSS_PROC VARCHAR(1),
INT_NUM NUMERIC(15,0),
FLOAT_NUM NUMERIC(18,6),
DATE_1 TIMESTAMP,
DATE_2 TIMESTAMP)
;
CREATE UNIQUE INDEX BSS_USER_CONTROL_PK
ON BSS_USER_CONTROL (BSS_MODULE, USER_ID, CONTROL_NO)
;
ALTER TABLE BSS_USER_CONTROL
ADD CONSTRAINT BSS_USER_CONTROL_PK PRIMARY KEY (BSS_MODULE, USER_ID,
CONTROL_NO)
;
--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork
http://www.bss-software.com
[Non-text portions of this message have been removed]