Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> 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
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlReceived on Fri Mar 19 2004 - 09:55:58 CST
-----------------------------------------------------------------
![]() |
![]() |