Fomatar Casas Decimais
Estou com um grande problema como retornar casas decimais já formatadas tenho uma tabela que tem dois campos um e o resultado(Já formatado), outro o nº de casas decimais gostaria qua ao retornar a minha pesquisa ele já traga a quantidade de casas decimais
fiz assim mas esta dando problemão, estou utilizando uma SP
declare variable RES VARCHAR (50);
declare variable VLS DECIMAL (18,4);
if (VLS IS NOT NULL) then begin
RESUL = VLS;
if (DDDC=0) then
RESUL = RESUL = CAST (VLS AS DECIMAL(18,0));
if (DDDC=1) then
RESUL = RESUL = CAST (VLS AS DECIMAL(18,1));
( ( VLS - Truncate(VLS) ) * 10 ) AS DECIMAL(18,2) );
if (DDDC=2) then
RESUL = CAST (VLS AS DECIMAL(18,2));
if (DDDC=3) then
RESUL = CAST (VLS AS DECIMAL(18,3));
if (DDDC=4) then
RESUL = CAST (VLS AS DECIMAL(18,4));
end
porém ele esta me retornando um ponto em vez de ,
alguem tem uma solução...
fiz assim mas esta dando problemão, estou utilizando uma SP
declare variable RES VARCHAR (50);
declare variable VLS DECIMAL (18,4);
if (VLS IS NOT NULL) then begin
RESUL = VLS;
if (DDDC=0) then
RESUL = RESUL = CAST (VLS AS DECIMAL(18,0));
if (DDDC=1) then
RESUL = RESUL = CAST (VLS AS DECIMAL(18,1));
( ( VLS - Truncate(VLS) ) * 10 ) AS DECIMAL(18,2) );
if (DDDC=2) then
RESUL = CAST (VLS AS DECIMAL(18,2));
if (DDDC=3) then
RESUL = CAST (VLS AS DECIMAL(18,3));
if (DDDC=4) then
RESUL = CAST (VLS AS DECIMAL(18,4));
end
porém ele esta me retornando um ponto em vez de ,
alguem tem uma solução...
Sremulador
Curtidas 0