Re: [firebird-support] SP space chacarter problem in FB2.5
Then the new SP remains: create or alter procedure VER_EDAD ( N_EDAD numeric(15,4), SEPARADOR varchar(1), CORTO char(1)) returns ( C_EDAD varchar(8)) as begin /* Procedure Text */ if (separador is null) then separador = ' '; if (corto is null) then corto = 'N'; c_edad = CASE when :n_edad > 1 then cast(cast(:n_edad as integer) as varchar(3))||separador||iif(upper(corto)='N','Años', 'A') when :n_edad = 1 then cast(cast(:n_edad as integer) as varchar(3))||separador||iif(upper(corto)='N','Año', 'A') when :n_edad > 0.01 then cast(cast(:n_edad*100 as integer) as varchar(3))||separador||iif(upper(corto)='N','Meses', 'M') when :n_edad = 0.01 then cast(cast(:n_edad*100 as integer) as varchar(3))||separador||iif(upper(corto)='N','Mes', 'M') when :n_edad > 0.0001 then cast(cast(:n_edad*1 as integer) as varchar(3))||separador||iif(upper(corto)='N','Días', 'D') when :n_edad = 0.0001 then cast(cast(:n_edad*1 as integer) as varchar(3))||separador||iif(upper(corto)='N','Día', 'D') when :n_edad = 0 then 'RN' end; suspend; end Thank you very much to all
Re: [firebird-support] SP space chacarter problem in FB2.5
On 23-10-2018 17:31, Germán Balbi bal...@yahoo.com [firebird-support] wrote: > in the netx SP send the follow parameters > 5,' ','N' --->>>5 Años (perfect) > 5,'','N' --->>>5 Años ( not 5Años) without space of separation >:( > > create or alter procedure VER_EDAD ( > N_EDAD numeric(15,4), > SEPARADOR char(1), > CORTO char(1)) You will need to use VARCHAR instead of CHAR. CHAR values are **always** padded with space up to the declared length. So if you assign '' (empty string) to a CHAR(1), it will actually be a ' ' (single space). This is the SQL standard defined behavior for CHAR. Mark -- Mark Rotteveel
Re: [firebird-support] SP space chacarter problem in FB2.5
23.10.2018 17:31, Germán Balbi bal...@yahoo.com [firebird-support] wrote: > in the netx SP send the follow parameters Read Firebird Language Reference to find out the difference between CHAR and VARCHAR data types. -- WBR, SD.
[firebird-support] SP space chacarter problem in FB2.5
Hi.in the netx SP send the follow parameters5,' ','N' --->>>5 Años (perfect) 5,'','N' --->>>5 Años ( not 5Años) without space of separation create or alter procedure VER_EDAD ( N_EDAD numeric(15,4), SEPARADOR char(1), CORTO char(1)) returns ( C_EDAD varchar() as begin /* Procedure Text */ if (separador is null) then separador = ' '; if (corto is null) then corto = 'N'; c_edad = CASE when :n_edad > 1 then trim(cast(cast(:n_edad as integer) as char(3)))||separador||iif(upper(corto)='N','Años', 'A') when :n_edad = 1 then trim(cast(cast(:n_edad as integer) as char(3)))||separador||iif(upper(corto)='N','Año', 'A') when :n_edad > 0.01 then trim(cast(cast(:n_edad*100 as integer) as char(3)))||separador||iif(upper(corto)='N','Meses', 'M') when :n_edad = 0.01 then trim(cast(cast(:n_edad*100 as integer) as char(3)))||separador||iif(upper(corto)='N','Mes', 'M') when :n_edad > 0.0001 then trim(cast(cast(:n_edad*1 as integer) as char(3)))||separador||iif(upper(corto)='N','Días', 'D') when :n_edad = 0.0001 then trim(cast(cast(:n_edad*1 as integer) as char(3)))||separador||iif(upper(corto)='N','Día', 'D') when :n_edad = 0 then 'RN' end; suspend; end