> My problem consists of a varchar(10) that are all numeric. They
> are telephone
> numbers and I want to convert them during a select statement to (XXX)
> XXX-XXXX
Would this work?
CREATE FUNCTION format_us_phone(varchar)
RETURNS varchar AS '
BEGIN;
SELECT "(" || SUBSTR($1,0,3) || ")" || SUBSTR($1,3,3) || "-" ||
SUBSTR($1,6,4);
END; ' LANGUAGE 'sql';
then..
SELECT format_us_phone(phonefield) FROM...;