Re: Removing a decimal from a number

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 18 Feb 1999 19:07:15 GMT
Message-ID: <7ahod3$ddc$1_at_relay1.dsccc.com>


Well, if you like substring code, you could TO_CHAR the number into a variable. Use INSTR to return the location of the decimal point. Use it with SUBSTR to append the two pieces back together.

	var = to_number (num_field) ;
	x = instr (var, '.') ;

	if x = 0 then
	  new_var = var ;
	else
	  new_var = substr (var, 1, x-1) || substr (var, x+1) ;
	end if ;


david.skergan_at_cplc.com wrote:
: In a stored procedure, I am trying to read decimal values from a table and
: export them to a flat file WITHOUT their decimal point.

: For example:

: Value: 3.14159 Desired result: 314159
: Value: 200.32 Desired result: 20032

: What is the best way to do this?

: Thanks...

: -----------== Posted via Deja News, The Discussion Network ==----------
: http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

--
While Alcatel may claim ownership of all my ideas (on or off the job),
Alcatel does not claim any responsibility for them. Warranty expired when u
opened this article and I will not be responsible for its contents or use.
Received on Thu Feb 18 1999 - 20:07:15 CET

Original text of this message