Using INTERVAL or DATETIME as a Column Name

The examples in this section show workarounds for using the keyword INTERVAL (or DATETIME) as a column name in a SELECT statement.

Using interval as a column name causes the following example to fail because the database server interprets interval as a keyword and expects it to be followed by an INTERVAL qualifier:
SELECT interval FROM mytab; -- fails 
If the DELIMIDENT environment variable is set, you could use interval as a column name, as the following example shows:
SELECT "interval" from mytab; -- successful
The workaround in the following example removes ambiguity by specifying a table name with the column name:
SELECT mytab.interval FROM mytab;
The workaround in the following example includes an owner name with the table name:
SELECT josh.mytab.interval FROM josh.mytab;

Copyright© 2019 HCL Technologies Limited