Одинаковые значения из последовательности

Cheese)))
Дата: 01.12.2009 11:49:00
select SEQ_USERS.NextVal,SEQ_USERS.CurrVal,SEQ_USERS.NextVal from dual

Получаю везде одно и тоже значение во всех 3 столбцах. Это нормально да? Ткните, пожалуйста, где это задокументировано?
Добрый Э - Эх
Дата: 01.12.2009 11:53:15
Это нормально. Всё именно так быть и должно
Добрый Э - Эх
Дата: 01.12.2009 12:03:47
Для себя считай, что сервер в этом случае переписывает запрос так:
select :par1, :par2, :par1 from dual;
Ну а присвоение значений переменным привязки делает один раз, потому для всех случаев вхождения вызова SEQ_USERS.NextVal он подставляет одно и тоже значение. А уж SEQ_USERS.CurrVal так вообще ничего не остается, как вернуть тоже самое значение, что выдал SEQ_USERS.NextVal
Добрый Э - Эх
Дата: 01.12.2009 12:57:42
В доке, кстати, это всё описано:

Oracle9i SQL Reference
Release 2 (9.2)
Part Number A96540-02
Within a single SQL statement containing a reference to NEXTVAL, Oracle increments the sequence only once:

* For each row returned by the outer query block of a SELECT statement. Such a query block can appear in the following places:
o A top-level SELECT statement
o An INSERT ... SELECT statement (either single-table or multi-table). For a multi-table insert, the reference to NEXTVAL must appear in the VALUES clause, and the sequence is updated once for each row returned by the subquery, even though NEXTVAL may be referenced in multiple branches of the multi-table insert.
o A CREATE TABLE ... AS SELECT statement
o A CREATE MATERIALIZED VIEW ... AS SELECT statement
* For each row updated in an UPDATE statement
* For each INSERT statement containing a VALUES clause
* For row "merged" (either inserted or updated) in a MERGE statement. The reference to NEXTVAL can appear in the merge_insert_clause or the merge_update_clause.

If any of these locations contains more than one reference to NEXTVAL, then Oracle increments the sequence once and returns the same value for all occurrences of NEXTVAL.

If any of these locations contains references to both CURRVAL and NEXTVAL, then Oracle increments the sequence and returns the same value for both CURRVAL and NEXTVAL.
Cheese)))
Дата: 01.12.2009 13:55:22
надеюсь в 10 и в 11 это не изменилось

select SEQ_USERS.CurrVal, SEQ_USERS.NextVal,SEQ_USERS.NextVal from dual
так тоже одинаково выведет

If any of these locations contains references to both CURRVAL and NEXTVAL, then Oracle increments the sequence and returns the same value for both CURRVAL and NEXTVAL.
Добрый Э - Эх
Дата: 01.12.2009 13:59:43
Кто мешает найти соответствующие куски доки по 10g / 11g?
Уверен, там всё тоже самое будет, слово в слово.
Просто мы до сих пор сидим на 9i, вот я доку только по ней и читаю...
Добрый Э - Эх
Дата: 01.12.2009 14:08:34
Вот соответствующий раздел по 10g.
А вот - по 11g

Как я и говорил - слово в слово
Cheese)))
Дата: 01.12.2009 19:18:12
Теперь когда документально подтверждено можно смело использовать, а то до этого как-то побаивался
Cheese)))
Дата: 01.12.2009 19:19:17
Спсаибо!