-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathoos_util_base.pks
More file actions
50 lines (43 loc) · 1.29 KB
/
oos_util_base.pks
File metadata and controls
50 lines (43 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
create or replace package oos_util_base
as
-- TYPES
-- CONSTANTS
/**
* @TODO: determine if symbols should follow pattern (digits, upper, lower) or (digits, lower, upper)
* [1] - https://pgregg.com/projects/php/base_conversion/base_conversion.inc.phps
* [2] - https://www.dcode.fr/base-n-convert
*
* @constant gc_symbols list of alphanumeric characters
* @constant gc_binary 2
* @constant gc_octal 8
* @constant gc_decimal 10
* @constant gc_hex 16
*/
gc_symbols constant varchar2(62 char) := '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
gc_binary constant pls_integer := 2;
gc_octal constant pls_integer := 8;
gc_decimal constant pls_integer := 10;
gc_hex constant pls_integer := 16;
-- METHODS
function to_base(
p_int in pls_integer,
p_base in pls_integer,
p_alphabet in varchar2 default gc_symbols)
return varchar2;
function to_binary(
p_int in pls_integer,
p_space_every in pls_integer default 0)
return varchar2;
function to_octal(
p_int in pls_integer)
return varchar2;
function to_hex(
p_int in pls_integer)
return varchar2;
function to_decimal(
p_str in varchar2,
p_base in pls_integer,
p_alphabet in varchar2 default gc_symbols)
return pls_integer;
end oos_util_base;
/