Saturday, 7 September 2013

How can I find unknown number between specific numbers?

How can I find unknown number between specific numbers?

How can I find unknown number between specific numbers? For example I want
to find the start with value from following question... How can I do that?
Given Values
Min number=20
Max Number=500
increment number=10
start with=? needs to be find.
how many times it increments= Always 5
where the cycle stopped now= 205
Conditions;
1. Start with number has to be either 20 or 500 or between 20-500...
2. It always increment 5 times.For example, If the start with number is 75
than numbers goes like First cycle=(75,85,95,105,115) Second
cycle=(125,135,145,155,165)...Third cycle (175,185,195,205) and it stops
on 205.
Question is: If start with number not known. is there any way to find it?
Actually problem in oracle
CREATE SEQUENCE "MY_TEST" MINVALUE 1 MAXVALUE 9999999999999999999999999
INCREMENT BY 1 START WITH 1000 CACHE 20 NOORDER NOCYCLE
Min Value 1
Max Value 9999999999999999999999999
Increment By 1
Cycle Flag N
Order Flag N
Cache Size 20
Last Number 1000
SELECT DBMS_METADATA.GET_DDL('SEQUENCE','MY_TEST') FROM DUAL
DBMS_METADATA.GET_DDL('SEQUENCE','MY_TEST')
CREATE SEQUENCE "ETBIN"."MY_TEST" MINVALUE 1 MAXVALUE
9999999999999999999999999 INCREMENT BY 1 START WITH 1000 CACHE 20 NOORDER
NOCYCLE
SELECT MY_TEST.NEXTVAL FROM DUAL
NEXTVAL
1000
SELECT MY_TEST.NEXTVAL FROM DUAL
NEXTVAL
1001
SELECT DBMS_METADATA.GET_DDL('SEQUENCE','MY_TEST') FROM DUAL
DBMS_METADATA.GET_DDL('SEQUENCE','MY_TEST')
CREATE SEQUENCE "ETBIN"."MY_TEST" MINVALUE 1 MAXVALUE
9999999999999999999999999 INCREMENT BY 1 START WITH 1020 CACHE 20 NOORDER
NOCYCLE
The above indicates there can be cases you cannot be sure about the value
the sequence started with- therefore I want to try to find the result in
other way around. Thanks

No comments:

Post a Comment