Hi
I've got a view based on three tables joined together, one of which (Contract) has SYSTEM_TIME Versioning enabled (view definition included at the bottom of this post). This has allowed me to interogate the view using Time Travel Query:
select * from contract_details for system_time as of '02/02/2012'
This works fine until you enable another of the tables within the view for SYSTEM_TIME and then you get
SQL0727N An error occurred during implicit system action type "3".
Information returned for the error includes SQLCODE "-203", SQLSTATE "42702"
and message tokens "SYSTEM_BEGIN". SQLSTATE=56098
But what can you use to qualify the SYSTEM_TIME? Expressing it as
below gives an SQL0104.
select * from contract_details for CONTRACT.system_time as of '02/02/2012' ;
Does anyone know the correct way to express this query?
Regards
Mark Gillis
CREATE OR REPLACE VIEW Contract_Details
AS
SELECT
SUBSTR(Customer.Name,1,15) as Customer_Name
,Contract_Number
,Contract_Type
,Start_Date
,End_Date
,Smallint(Days(End_Date) - Days(Start_Date)) as Days
,Hours
,DATE(system_begin) as Sys_BEGIN_date
,TIME(system_begin) as Sys_BEGIN_TIME
,DATE(system_end) as Sys_end_date
,TIME(system_end) as Sys_end_TIME
FROM
Contract inner join
Customer on Contract.Customer_ID = Customer.Customer_ID
inner join
Contract_Type on Contract.Contract_Type_ID = Contract_Type.Contract_Type_ID
I've got a view based on three tables joined together, one of which (Contract) has SYSTEM_TIME Versioning enabled (view definition included at the bottom of this post). This has allowed me to interogate the view using Time Travel Query:
select * from contract_details for system_time as of '02/02/2012'
This works fine until you enable another of the tables within the view for SYSTEM_TIME and then you get
SQL0727N An error occurred during implicit system action type "3".
Information returned for the error includes SQLCODE "-203", SQLSTATE "42702"
and message tokens "SYSTEM_BEGIN". SQLSTATE=56098
But what can you use to qualify the SYSTEM_TIME? Expressing it as
below gives an SQL0104.
select * from contract_details for CONTRACT.system_time as of '02/02/2012' ;
Does anyone know the correct way to express this query?
Regards
Mark Gillis
CREATE OR REPLACE VIEW Contract_Details
AS
SELECT
SUBSTR(Customer.Name,1,15) as Customer_Name
,Contract_Number
,Contract_Type
,Start_Date
,End_Date
,Smallint(Days(End_Date) - Days(Start_Date)) as Days
,Hours
,DATE(system_begin) as Sys_BEGIN_date
,TIME(system_begin) as Sys_BEGIN_TIME
,DATE(system_end) as Sys_end_date
,TIME(system_end) as Sys_end_TIME
FROM
Contract inner join
Customer on Contract.Customer_ID = Customer.Customer_ID
inner join
Contract_Type on Contract.Contract_Type_ID = Contract_Type.Contract_Type_ID