Groups > Interbase > Interbase General discussion > Re: rounding




Re: rounding

Re: rounding
28 Mar 2008 06:26:36 -0700
Sergio Gonzalez wrote:

> How can I round numbers inside a stored procedure?

	CAST AS INTEGER:

  MY_INT_VARIABLE = CAST (MY_DOUBLE_VARIABLE AS INTEGER);

-- 
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Please read and follow Borland's rules for the user of their 
Post Reply
Re: rounding
28 Mar 2008 06:50:47 -0700
Sergio Gonzalez wrote:

> So I can do the same with numerics?

	Yes. 

	That said, we define our own rounding proc, since we use a different
rounding method (more like a CEIL than a ROUND). See if the default
method fits your needs, and if not, write your own proc which uses
rounding to integer and multiplication to implement your own.

-- 
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
  Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Borland newsgroup denizen Sergio González has a new CD of 
Post Reply
rounding
Fri, 28 Mar 2008 09:52:17 -030
Hello,
How can I round numbers inside a stored procedure?
Thanks in advance!
Sergio 

Post Reply
Re: rounding
Fri, 28 Mar 2008 10:45:58 -030
> CAST AS INTEGER:
>  MY_INT_VARIABLE = CAST (MY_DOUBLE_VARIABLE AS INTEGER);

Thanks Craig! So I can do the same with numerics?

MY_INT_VARIABLE = CAST (MY_DOUBLE_VARIABLE AS numeric(18,2));

I didn't know CAST would work outside a SELECT statement! 

Post Reply
about | contact