[
https://issues.apache.org/jira/browse/DERBY-4513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12799745#action_12799745
]
Rick Hillegas commented on DERBY-4513:
--------------------------------------
Hi Knut,
Yes, that's an accurate summary of the restriction I'm proposing. Note that
there is an ungainly workaround for the insert case you mention. Instead of a
values clause, you can use a subquery which selects from sysibm.sysdummy1:
connect 'jdbc:derby:memory:dummy;create=true';
create table t( a int, b int );
create sequence seq1;
insert into t( a, b )
select s.c, s.c
from ( select next value for seq1 as c from sysibm.sysdummy1 ) as s;
select * from t;
Thanks,
-Rick
> Forbid NEXT VALUE FOR clause in certain contexts
> ------------------------------------------------
>
> Key: DERBY-4513
> URL: https://issues.apache.org/jira/browse/DERBY-4513
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.6.0.0
> Reporter: Rick Hillegas
>
> This is part of the work needed to implement ANSI/ISO sequences. The
> functional spec attached to DERBY-712 lists various situations in which the
> NEXT VALUE FOR clause is illegal. These include:
> * CASE expression
> * WHERE clause
> * ORDER BY clause
> * AGGREGATE expression
> * WINDOW function
> * DISTINCT select list
> In addition, I propose that we make it illegal for a statement to have more
> than one NEXT VALUE FOR clause on the same sequence generator. This is a
> tighter restriction than the ANSI/ISO standard calls for. The standard
> requires that if two columns in a row are populated by NEXT VALUE FOR clauses
> on the same sequence, then the values should be the same. I don't feel
> confident that I could track down all of the cases which could give rise to
> this situation--so I propose to limit the number of NEXT VALUE FOR clauses on
> a given sequence generator to just 1.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.