How to access the current value and next value from a
sequence?
Answers were Sorted based on User's Feedback
Answer / saty
select sequencename.currval from dual
select sequencename.nextval from dual
if we will give only table name thr will be error
Thanks & regards
satya
+919916174212
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / chandrasekar ramasamy
select sequencename.currval from tablename
select sequencename.nextval from tablename
| Is This Answer Correct ? | 8 Yes | 3 No |
Answer / shai
select *
from user_sequences;
The last_number column will display the number available
next.
if no_cache is used in sequence definition then you can
trust on last_number column from user_sequence.
But if cache is used then below will take place:
If Cache is 20 then last_number will display any number
within range of sequence currval+20
| Is This Answer Correct ? | 0 Yes | 1 No |
Answer / p.rajasekar
We cannot directly get Current value from the sequence.So
first we need to get the next value, then we can get the
current value in the same scope
select sequencename.nextval from tablename
select sequencename.currval from tablename
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sweta
select sequencename.currval,sequencename.nextval from dual;
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / tulsi
select currval.sequence_name from table_name
select nextval.sequence_name from table_name
| Is This Answer Correct ? | 0 Yes | 9 No |
Is oracle sql free?
Explain dml and ddl?
what is the difference between trigger and constraint?
how many sql ddl commands are supported by 'mysql'? : Sql dba
What is the difference between join and natural join?
how can we destroy the cookie? : Sql dba
What is data abstraction in sql?
what is bcp? When is it used?
What is the purpose of normalization?
What is sql query limit?
What are the dml statements?
In table three columns with 1 milion records(here there is no sequence values) i want add one more column with sequence values from the first how it is posible?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)