例 - Teradata Database - Teradata Vantage NewSQL Engine - IS UNTIL_CLOSED/IS NOT UNTIL_CLOSED関数、例。

Teradata Vantage™ SQL日付と時刻の関数および式

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
2019年3月
Language
日本語
Last Update
2019-10-29
dita:mapPath
ja-JP/pxz1544241488545.ditamap
dita:ditavalPath
ja-JP/pxz1544241488545.ditaval
dita:id
B035-1211
Product Category
Software
Teradata Vantage
CREATE MULTISET TABLE employee(
 empno INTEGER,
 ename VARCHAR(50),
 deptno INTEGER,
 jobstart TIMESTAMP WITH TIME ZONE NOT NULL 
   GENERATED ALWAYS AS ROW START,
 jobend TIMESTAMP WITH TIME ZONE NOT NULL AS 
   GENERATED ALWAYS AS ROW END,
 PERIOD FOR SYSTEM_TIME(jobstart,jobend)
 )
 PRIMARY INDEX(empno) WITH SYSTEM VERSIONING;

テーブルに以下の行が含まれているとします。

empno ename  deptno                          jobstart                            jobend

----- ------ ------  --------------------------------  --------------------------------

1025 John      999  2005-02-03 12:12:12.123456+00:00  9999-12-31 23:59:59.999999+00:00

次のSELECT文の結果は次のとおりです。

SELECT empno,ename(CHAR(6)) FROM employee 
 WHERE END(SYSTEM_TIME) IS UNTIL_CLOSED;

empno ename
------ ------
  1025 John


SELECT empno,ename(CHAR(6)) FROM employee 
 WHERE END(SYSTEM_TIME) IS NOT UNTIL_CLOSED;

*** Query completed. No rows found.