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

Home -> Community -> Usenet -> c.d.o.server -> Re: Reading VARCHAR fileds as Integers ...

Re: Reading VARCHAR fileds as Integers ...

From: Michael J. Moore <NOhicamelSPAM_at_comcast.net>
Date: Thu, 27 Nov 2003 03:02:35 GMT
Message-ID: <fPdxb.319205$Fm2.332915@attbi_s04>


Gee, lets see...

SQL> create table test (el1 varchar2(20));

Table created.

SQL> create view vtest as select to_number(el1) num from test;

View created.

SQL> insert into test values ('123');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from vtest;

       NUM


       123

SQL> Yep, seems to work.

"Tinku" <anbharga_at_cisco.com> wrote in message news:c47f56ca.0311261611.10a40f25_at_posting.google.com...
> Hi All
> I am new to Oracle so pardon
> Is it possible to do the following.
>
> I have a table with lots of VARCHAR columns. In this table We put all
> kinds of data (integers / strings / small ) etc.
> Now is it possible to define a view on this table such that I can
> "read" these varchar columns as "integer" or small if they were put in
> like that.
>
> so what it means is is the value in COL1 (of type varchar) is "4562",
> I should be able to read it as if the column type was integer and read
> it into a integer host variable.
>
> Thanks
> Ankur
Received on Wed Nov 26 2003 - 21:02:35 CST

Original text of this message

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