How to access the current value and next value from a
sequence?

Answers were Sorted based on User's Feedback



How to access the current value and next value from a sequence?..

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

How to access the current value and next value from a sequence?..

Answer / chandrasekar ramasamy

select sequencename.currval from tablename

select sequencename.nextval from tablename

Is This Answer Correct ?    8 Yes 3 No

How to access the current value and next value from a sequence?..

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

How to access the current value and next value from a sequence?..

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

How to access the current value and next value from a sequence?..

Answer / sweta

select sequencename.currval,sequencename.nextval from dual;

Is This Answer Correct ?    0 Yes 2 No

How to access the current value and next value from a sequence?..

Answer / tulsi

select currval.sequence_name from table_name

select nextval.sequence_name from table_name

Is This Answer Correct ?    0 Yes 9 No

Post New Answer

More SQL PLSQL Interview Questions

Is left join same as inner join?

0 Answers  


What is scope and visibility in PL/SQL?

0 Answers  


there are .......different types of serializability

1 Answers   Wipro,


what is data integrity? : Sql dba

0 Answers  


which will fire first ? Trigger or Constraint

24 Answers   i2, IBM,






how can you see all indexes defined for a table? : Sql dba

0 Answers  


Explain what is dbms?

0 Answers  


Explain the difference between 'between' & 'and' operators in sql

0 Answers  


consider a table which contain 4 columns,ename,eno,sal and deptno, from this table i want to know ename who having maximum salary in deptno 10 and 20.

24 Answers   Mind Tree,


How to maintain the history of code changes of pl/sql?

3 Answers  


How do you create an update query?

0 Answers  


Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;

7 Answers   Accenture,


Categories