Name

base36enc, base36dec — encode and decode non-negative integers as compact base-36 strings

Synopsis

varchar base36enc( in value integer);
 
integer base36dec( in encoded varchar);
 

Description

base36enc encodes the non-negative 64-bit integer value as a base-36 string using the digit alphabet 0-9 followed by uppercase A-Z. The encoding is the same one used by JavaScript's Number.prototype.toString(36) and is convenient for producing short, URL-safe identifiers from numeric keys. Values must be in the range 0 .. INT64_MAX.

base36dec parses encoded as a base-36 number (case-insensitive) and returns the resulting non-negative integer.

Examples

Example 24.242. Round-trip an integer

SQL> select base36enc (123456789);
-- 21I3V9
SQL> select base36dec ('21I3V9');
-- 123456789
      


© 1992 - OpenLink Software. All rights reserved.

Making Technology Work for You®