db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6332) Support SQL92 Interval on 10.9.1 (ships with glassfish)
Date Thu, 05 Sep 2013 13:48:52 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13759072#comment-13759072
] 

Knut Anders Hatlen commented on DERBY-6332:
-------------------------------------------

Derby supports an alternative syntax, the JDBC escape syntax. The corresponding statements
would look like this:

{noformat}
ij> create table c (c timestamp);
0 rows inserted/updated/deleted
ij> insert into c values { fn timestampadd(sql_tsi_day, -2, current_timestamp) };
1 row inserted/updated/deleted
ij> insert into c values { fn timestampadd(sql_tsi_day, -1, current_timestamp) };
1 row inserted/updated/deleted
ij> insert into c values { fn timestampadd(sql_tsi_hour, -1, current_timestamp) };
1 row inserted/updated/deleted
ij> insert into c values { fn timestampadd(sql_tsi_day, 1, current_timestamp) };
1 row inserted/updated/deleted
ij> select * from c;
C                            
-----------------------------
2013-09-03 15:27:59.463      
2013-09-04 15:28:03.159      
2013-09-05 14:28:05.274      
2013-09-06 15:28:07.576      

4 rows selected
{noformat}
                
> Support SQL92 Interval on 10.9.1 (ships with glassfish)
> -------------------------------------------------------
>
>                 Key: DERBY-6332
>                 URL: https://issues.apache.org/jira/browse/DERBY-6332
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.9.1.0
>         Environment: javadb shipped with glassfish
>            Reporter: Aron Rodrigues
>
> I can't run sql92 queries like
> create table c (c datetime);
> insert into c values(CURRENT_TIMESTAMP - INTERVAL 2 DAY);
> insert into c values(CURRENT_TIMESTAMP - INTERVAL '1' DAY);
> insert into c values(CURRENT_TIMESTAMP - INTERVAL '1' HOUR);
> insert into c values(CURRENT_TIMESTAMP-INTERVAL '-1' DAY);
> select * from c;

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message