Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Create view using CAST to change datatype

RE: Create view using CAST to change datatype

From: John Flack <JohnF_at_smdi.com>
Date: Fri, 19 Mar 2004 10:59:31 -0500
Message-ID: <91AFBA9B76078B4E8340A383EADEF1DB7EE57B@syn2kex1.smdi.com>


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



Please see the official ORACLE-L FAQ: http://www.orafaq.com

To unsubscribe send email to: oracle-l-request_at_freelists.org put 'unsubscribe' in the subject line.
--
Archives are at http://www.freelists.org/archives/oracle-l/
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html

-----------------------------------------------------------------
Received on Fri Mar 19 2004 - 09:55:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US