Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Converting from VARCHAR2 to CHAR in a view (7.1)
On Thu, 19 Feb 1998 17:59:30 +0100, "Igor Milavec" <igor.milavec_at_l-sol.si> wrote:
>Hi.
>
>I'm trying to create a view which converts from a VARCHAR2 column to a CHAR.
>I tried to use the following:
>CREATE VIEW "VContact" AS
>SELECT TO_CHAR(Description, 'SSSSS')
>FROM "Contact"
Why do you want to convert from a varchar2 column to a char? Those types are usually assignment compatible. And TO_CHAR accepts a number and returns a VARCHAR2 anyway.
So here's what's happening to you....it's trying to convert description into a number in order to match to_char( x IN NUMBER, y IN VARCHAR2 ) and failing badly. If you fail with one row it blows your whole result set away....Oracle is annoying that way.
/cpk Received on Thu Feb 19 1998 - 00:00:00 CST
![]() |
![]() |