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!

How to generate all strings between a low and high value?

OTDeveloperAug 21 2015 — edited Aug 24 2015

Dear Friends,

I have a requirement to generate all strings between a given low and high value.

Below is a sample input and expected output.

Input:

Sample data for my scenario is as follows.

create table test_sn(detail_id number,from_serial_num varchar2(30), to_serial_num varchar2(30));

insert into test_sn values (1,'S150722636','S150722638');

insert into test_sn values (1,'S15072263A','S15072263C');

insert into test_sn values (1,'S1507226AA','S1507226AC');

insert into test_sn values (1,'S1507225AA','S1507225AA');

Column from_serial_num has the low value and  the column to_serial_num has the high value.

Expected Output:

1     S150722636

1     S150722637

1     S150722638

1     S15072263A

1     S15072263B

1     S15072263C

1     S1507226AA

1     S1507226AB

1     S1507226AC

1     S1507225AA

Could any one advise on the query for this requirement?

Regards,

Sreekanth

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2015
Added on Aug 21 2015
33 comments
2,851 views