Search code examples
sqlselectjasper-reportsireportoracle-sqldeveloper

reprint barcodes (between) SQL


I've got a difficult select i'm trying to figure out.

PART 1

So I have to be able to reprint barcodes between two numbers. ex reprint barcodes between 50and 60. That will give you 50, 51 etc etc to 60.

I've figured this out but the second part is what gets me.

with bar_no as (   
select 50 start_bar, 60 end_bar from dual)   
select numbers   
from (select level numbers  
       from dual  
    connect by level <= (select max(end_bar) from bar_no)) a  
where exists (  
 select 1  
   from bar_no  
  where numbers between bar_no.start_bar and bar_no.end_bar)

PART 2

Every barcode number must be printed 5 times. So 50 must be printed 5 times before starting with 51.

ex 50, 50 ,50, 50 ,50, 51, 51, 51, 51, 51 .... etc

if someone can help me out with this please.

Im using Jasper iReport. So if there is a beter way of doing this in iReport. Please let me know.

Thanks


Solution

  • I could not get it to work using Jasper ireport.

    So decided to just use my above SQL and advance it a bit.

    Check answer here