Tom,
> Is there a way of casting from a varchar to a numeric type?
>
> 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
>
> Anybody have any ideas?
Well, first off, you need to know the PostgreSQL conversion functions.
See the online documentation: Functions and Operators --> Formatting
Functions.
Second, if you check Roberto Mello's PL/pgSQL cookbook, you'll notice
that I posted a set of functions which auto-format phone numbers to US
spec.
http://www.brasileiro.net/postgres/cookbook/
It's under "String Manipulation Functions".
-Josh Berkus