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: <oracle-l-bounce_at_freelists.org>
Date: Fri, 19 Mar 2004 11:03:12 -0500
Message-ID: <4C9B6FDA0B06FE4DAF5918BBF0AD82CF03B45383@bosmail00.bos.il.pqe>


In the world according to Oracle, a zero-length string is indistinguishable from a NULL. Yes, I'm that's incompatible w/ ANSI, but that's what Oracle does. It's well documented behavior, and it's not likely to change anytime soon.

-Mark

-----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



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

-----------------------------------------------------------------
----------------------------------------------------------------
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 - 10:00:06 CST

Original text of this message

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