Re: Reports -Formatting Varchar2 output

From: Wibble <nobody_at_Sun.COM>
Date: Mon, 04 Jun 2001 14:31:02 +0100
Message-ID: <3B1B8D96.F4F49B63_at_Sun.COM>


Jimbo wrote:
>
> Could somenone please give me some direction on Formatting output for phone
> numbers which are in our database as varchar2 and the help indicates that
> only numbers & dates can have a format mask

The simplest way is to wrap the column in a SQL function in your query in the data model.
e.g.:

SELECT	...
	'+'||SUBSTR(phone, 1,2)||' ('||SUBSTR(phone,3,4)||') '||SUBSTR(phone,5)
formatted_phone,
	...

This would print 441276621111 as +44 (1306) 621111

If you want to give the result a certain default length, wrap the whole expression in a RPAD() or SUBSTR() function, specifying your chosen length.

The permutations are enormous. Have fun. JR Received on Mon Jun 04 2001 - 15:31:02 CEST

Original text of this message