AW: AW: [firebird-support] Converting with parameters stored in variables?

2019-09-02 Thread 'Check_Mail' check_m...@satron.de [firebird-support]
Helle Karol,

 

thank you, now it works and it is more easier.

 

I have modified this:

 

SELECT lpad(cast(TRUNC(x.a) as integer), :i_anz, '0') || '.' || 
lpad((X.A-TRUNC(X.A))*X.B, 3, '0') FROM (SELECT cast(:z_str as double 
precision) AS A, POWER(10,:i_anz2) AS B FROM RDB$DATABASE) X

 

Without cast as integer I get the 100 to the left (100.300) (11.3), 
without casting as double precision, I get an error, cannot work with strings.

 

Thanks again 

 

 

Von: firebird-support@yahoogroups.com  
Gesendet: Samstag, 31. August 2019 09:20
An: firebird-support@yahoogroups.com
Betreff: ODP: AW: [firebird-support] Converting with parameters stored in 
variables?

 

  

>>Trunc instead of pow?

 

I only mean that you do not need to operate on strings to separate number.

 

A = 123.45 – numeric not a double

A1 = TRUNC(A)

A2 = (A-A1)*POWER(10,3)

 

Then 

A1 = 123

A2 = 450

 

SELECT LPAD(TRUNC(X.A), 10, '0') || '.' || LPAD((X.A-TRUNC(X.A))*X.B, 3, '0'), 
FROM (SELECT 100.12 AS A, POWER(10,3) AS B FROM RDB$DATABASE) X

 

Regards,

Karol Bieniaszewski





AW: AW: [firebird-support] Converting with parameters stored in variables?

2019-08-30 Thread 'Check_Mail' check_m...@satron.de [firebird-support]
Hallo Karol,

 

we have a rfc interface with a high bay storage an the telegram defines the 
different datatypes. If I would create a new material, I must set different 
parameters #name#weight…#111.111# and so on.

 

Trunc instead of pow?

 

Regards

 

Olaf 

 

Von: firebird-support@yahoogroups.com  
Gesendet: Freitag, 30. August 2019 10:04
An: firebird-support@yahoogroups.com
Betreff: Re: AW: [firebird-support] Converting with parameters stored in 
variables?

 

  

Hi,

 

You can do this simpler by using trunc.

 

But i ask why do you need this format in resultset? Formatting numbers is a 
client side task, same as for DATE.

 

 

Regards,

Karol Bieniaszewski