[firebase-br] Função DIGITS(), alguma maneira de contornar sua ausencia?
Gladiston Santana
gladiston em vidy.com.br
Seg Nov 7 12:54:51 -03 2016
devolvendo sua procedure já modificada, muito obrigado.
create or alter procedure get_digits (
str varchar (255))
returns (
result_value varchar (255))
as
declare variable tamstr_completo integer = 0;
declare variable tamstr_num integer = 0;
declare variable j integer;
declare variable c char (1);
begin
result_value=null;
tamstr_completo = octet_length(str); -- CHARACTER_LENGTH
tamstr_num=0;
if ((str is not null) and (tamstr_completo > 0)) then
begin
result_value = '';
tamstr_num = 0;
j = 1;
while (J <= tamstr_completo)do
begin
c = SUBSTRING (str FROM j FOR 1);
if ((c = '0') or (c = '1') or (c = '2') or (c = '3') or (c = '4')
or (c = '5') or (c = '6') or (c = '7') or (c = '8') or (c = '9'))
then
begin
result_value = result_value || c;
tamstr_num = tamstr_num + 1;
end
j = j + 1;
end
end
suspend;
end
Mais detalhes sobre a lista de discussão lista