Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Create view using CAST to change datatype
John,
Try this:
Tom Mercadante
Oracle Certified Professional
-----Original Message-----
From: John Flack [mailto:JohnF_at_smdi.com]
Sent: Friday, March 19, 2004 11:00 AM
To: oracle-l_at_freelists.org
Subject: RE: Create view using CAST to change datatype
That's interesting, because I thought that Oracle had changed things so that LTRIM(' ') would result in a string with a length of zero, which is not the same thing as a NULL. Guess I was wrong - but I wouldn't depend on my being wrong forever because the ANSI standard says zero length <> null.
-----Original Message-----
From: Mercadante, Thomas F [mailto:thomas.mercadante_at_labor.state.ny.us]
Sent: Friday, March 19, 2004 10:10 AM
To: 'oracle-l_at_freelists.org'
Subject: RE: Create view using CAST to change datatype
Saira,
This worked:
CREATE OR REPLACE VIEW tomview
AS
SELECT
col1, col2,
cast(NVL(RTRIM(col1),0) AS NUMBER) col1_numb
FROM tomtest
Values for the TOMTEST table were (' ',1);
SELECT * FROM tomview
returns
values of (' ', 1, 0)
And I agree wih Igor - why are you using CAST rather than to_number?
Tom Mercadante
Oracle Certified Professional
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlput 'unsubscribe' in the subject line.
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
![]() |
![]() |