Mittwoch, 22. Januar 2014

PL/SQL Generate Range of number

I had the problem to select a number field with leading blanks.. this is my solution:


SELECT LPAD (
             LEVEL + doc_num_from - 1
            ,12
            ,' '
            )
         AS rnum
  FROM DUAL
CONNECT BY LEVEL < doc_num_to - doc_num_from + 2

Keine Kommentare:

Kommentar veröffentlichen