Re: Sequential number gen function that uses letter A-Z

From: Charles Jardine <cj10_at_cam.ac.uk>
Date: 1996/08/02
Message-ID: <320213B0.6B57_at_cam.ac.uk>#1/1


Debor19071 wrote:
>
> It came up in a meeting I attended that there is a need to produce up to
> 36 values per digit of a varchar2(7) column - the 36 values would be 0-9 &
> A-Z
>
> Would anyone know of how we could do this.

Try something like

FUNCTION mod36(n IN NUMBER) RETURN VARCHAR2 IS BEGIN
  IF n = 0 THEN RETURN ''; END IF;
  RETURN mod36(floor(n/36)) ||
    DECODE(mod(n,36), 0, '0',

                      1, '1',
 ....
                      9, '9',
                     10, 'A',
                     11, 'B',
 ....
                     35, 'Z');

END; Received on Fri Aug 02 1996 - 00:00:00 CEST

Original text of this message