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: Saira Somani-Mendelin <saira_somani_at_yahoo.com>
Date: Fri, 19 Mar 2004 10:40:38 -0500
Message-ID: <004501c40dc8$87b0fcc0$e20110ac@itlap01>


I should also mention that along with the ORA-01722 error, I am also receiving the ORA-01002: Fetch out of sequence error.

FYI, we are using version 8.1.7.4 and I am using TOAD on w2k pro.

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Saira Somani-Mendelin
Sent: March 19, 2004 10:35 AM
To: oracle-l_at_freelists.org
Subject: RE: Create view using CAST to change datatype

I'm not sure why I'm leaning towards CAST...(I claim ignorance!)

In any case, I tried methods, both yours and Igor's, and received the same error:

ORA-01722: invalid number

Somewhere in this table, there is a strange value. I was trying to make life simpler without having to create multiple views to deal with these data value issues (filter the view by some criteria).

So here's another question (just out of curiosity), how can I determine which value is causing me problems?

Thanks for all your help so far! I appreciate the time. Saira

-----Original Message-----

From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Mercadante, Thomas F Sent: 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 - 09:34:16 CST

Original text of this message

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