Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Case when statement for sequence number

2913299Aug 31 2015 — edited Aug 31 2015

Hi all..

i have a query case when statement.

i will explain.

SELECT CASE WHEN 1 > 2 THEN DEV_RECEIPT_S1.NEXTVAL

                     WHEN 1 > 4 THEN DEV_RECEIPT_S2.NEXTVAL

                     WHEN 5 > 2 THEN DEV_RECEIPT_S3.NEXTVAL

END SEQ_TEST FROM DUAL;

Example :

Nextval for Sequence1 = 51

Nextval for Sequence2 = 17

Nextval for Sequence3 = 46

And if i run this select statement, i get value 46 and this is True.

But, if i check Sequence1 and Sequence2 increase 1, so Sequence1 = 52 and Sequence2 = 18.

And now, this value for sequence :

Nextval for Sequence1 = 52

Nextval for Sequence2 = 18

Nextval for Sequence3 = 47

Can i get value for Sequence1 and Sequence2 not change if i run, because just Sequence3 increase 1 ?

Help.

Thanks...

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2015
Added on Aug 31 2015
11 comments
1,315 views