here is my serial table.it has more than 1000 records.its with start number and end number.but between numbers not exist. i need to add all number [start/between & end numbers] records in another temp table number by number like below
EXIST TABLE
select concat(CARD_BULK_CODE,start_serial) startserial,concat(CARD_BULK_CODE,end_serial) endserial
from TSR_BULK_CARD_SERIALS
--------------------------- STARTSERIAL ENDSERIAL | --------------------------- 18126944 18126946 | 18141101 18141122 | 15150722 15150729 | 19069303 19069317 | ---------------------------
REQUIRED TABLE
----------- SERIAL_NO | ----------- 18126944 18126945 18141101 18141102 .... -----------
seem its need pl-sql to implement this. please help me to sort out this issue
I tried with below query with the help of dual. but its very slow and not yet got results :-) running more than 1 Hour
select distinct concat(t.CARD_BULK_CODE,t.START_SERIAL)+level-1 SERIAL
from TSR_BULK_CARD_SERIALS t, dual
connect by level-1<=(concat(t.CARD_BULK_CODE,t.END_SERIAL ))-concat(t.CARD_BULK_CODE,t.START_SERIAL)
order by 1
EDIT :
Dear Alen & Dba.i tried with your ones and below error occured.
DECLARE
l_st NUMBER;
l_en NUMBER;
BEGIN
FOR rec IN (select concat(card_bulk_code, start_serial) startserial,concat(card_bulk_code, end_serial) endserial from tsr_bulk_card_serials)
LOOP
l_st := rec.startserial;
l_en := rec.endserial;
FOR rec1 IN l_st..l_en
LOOP
INSERT INTO temp(serial_no) values(rec1);
END LOOP;
END LOOP;
COMMIT;
END;
Error at line 1
ORA-01426: numeric overflow
ORA-06512: at line 9
Script Terminated on line 1.