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

Can i use Commit inside the Trigger? Suppose i use commit what will be happy (it's complied /executed/work)

6 Answers  


What is implicit cursor in pl sql?

0 Answers  


Is sql scripting language?

0 Answers  


what is the command used to fetch first 5 characters of the string? : Sql dba

0 Answers  


What is a table partition?

0 Answers  






Is trigger a stored procedure?

0 Answers  


how to create a test table in your mysql server? : Sql dba

0 Answers  


What are user defined functions?

0 Answers  


What does an inner join do?

0 Answers  


How to Declare Fixed Length String Value In PL SQL

0 Answers  


What is t sql in sql server?

0 Answers  


4. Select sum(A.salary) +sum(B.salary) as TOT_SAL from ( select LEVEL emp_id,level*100 salary,case when mod (level,2)=0then 2 else null end dept_id from dual connect by level<6 )A right outer join (select level emp_id ,level*200 salary ,case when mod (level,3)=0 then 2 else null end dept_id from dual connect by level<6)B On A.dept_id=B.dept_id And A.emp_id=B.emp-id;

1 Answers   Fintellix,


Categories