Subject | Re: gen_uuid() question |
---|---|
Author | personalsoft_fabiano |
Post date | 2009-03-12T01:51:43Z |
It seems my previous e-mail is missing. Here is the code:
set term !! ;
create or alter procedure sp_uuid2hex (
uuid char(16) character set octets)
returns(
result varchar(32))
as
declare variable i integer;
declare variable c integer;
begin
result = '';
i = 1;
while (i <= octet_length(uuid)) do
begin
c = ascii_val(substring(uuid from i for 1));
result = result || substring('0123456789ABCDEF' from bin_shr(c, 4) + 1 for 1) || substring('0123456789ABCDEF' from bin_and(c, 15) + 1 for 1);
i = i + 1;
end
suspend;
end !!
set term ; !!
set term !! ;
create or alter procedure sp_uuid2hex (
uuid char(16) character set octets)
returns(
result varchar(32))
as
declare variable i integer;
declare variable c integer;
begin
result = '';
i = 1;
while (i <= octet_length(uuid)) do
begin
c = ascii_val(substring(uuid from i for 1));
result = result || substring('0123456789ABCDEF' from bin_shr(c, 4) + 1 for 1) || substring('0123456789ABCDEF' from bin_and(c, 15) + 1 for 1);
i = i + 1;
end
suspend;
end !!
set term ; !!