on 07-12-2015 5:03 AM
Hi Experts,
Sequence is not giving output as expected when we tried to follow the below steps as in help.sap.com,
CREATE SEQUENCE - SAP HANA SQL and System Views Reference - SAP Library
Instead of giving an output as 12 and 13, it gives as 12 and 12. (Problem occurs in both SP8 and SP9)
Could you please advise us if we need to set any Admin level parameter to make sequence work as in help.sap.com link.
Thanks and Regards,
Ram
My guess is that this is a documentation error and that the .nextval is actually only evaluated once per result row in your sub-query.
But to get an official statement on this, you may want to open a support incident.
- Lars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just stumbled over this by accident.
This is from
ANSI TC NCITS H2 ISO/IEC JTC 1/SC 32/WG 3 Database
WG3:HBA-003 H2-2003-305
Foundation (SQL/Foundation)
4.21.2 Operations involving sequence generators
[...] If there are multiple instances of <next value expression>s specifying the same sequence generator within a single SQL-statement, all those instances return the same value for a given row processed by that SQL-statement.
The behavior you observed is the normal one that you also see on other databases like Oracle (I just double-checked). If the documentation states something different, it's probably a docu bug like already assumed by Lars.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.