Home > database >  Oracle with sequence of nextval display multiple data, why?
Oracle with sequence of nextval display multiple data, why?

Time:10-03

SQL> The select exam_sequence. Nextval from exam;

NEXTVAL
-- -- -- -- -- -- -- -- -- --
83
84
85
86
87


SQL> The select exam_sequence. Currval from exam;

CURRVAL
-- -- -- -- -- -- -- -- -- --
103
103
103
103
103
103
There are six data in exam table, but and nextval, currval have what relation?

CodePudding user response:

Nextval, the next value of the sequence, each line to take a new value;

Currval, take the current value, each line to get the current value, so is the same;

CodePudding user response:

reference 1st floor wmxcn2000 response:
nextval, the next value of the sequence, each line to take a new value;

Currval, take the current value, each line to get the current value, so is the same;


Add
SQL> The select exam_sequence. Nextval from exam;

NEXTVAL
-- -- -- -- -- -- -- -- -- --
83
84
85
86
87

If 6 records, the result set is poor, and 88 a

CodePudding user response:

reference 1st floor wmxcn2000 response:
nextval, the next value of the sequence, each line to take a new value;

Currval, take the current value, each line to get the current value, so is the same;
  • Related