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 -> Repost: Setting view column datatype

Repost: Setting view column datatype

From: Brian Dick <bdick_at_cox.net>
Date: Thu, 29 Jan 2004 21:42:46 -0500
Message-ID: <DwjSb.1362$Yj.406@lakeread02>


Can anyone help on this?

"Brian Dick" <bdick_at_cox.net> wrote in message news:XJUOb.19335$Mb7.9762_at_lakeread04...
> Some of my view columns have numeric table columns as their underlying
> values, and some view columns have numeric expressions as their underlying
> values. If you describe the view, the datatype for the view column with
> numeric table columns show the table column datatype, including the
> precision and scale. However, the view columns with numeric expressions
only
> show NUMBER. I would like to restrict the view columns with numeric
> expressions to an explicit datatype, e.g. NUMBER(5). I tried wrapping the
> expression with a cast(... as number(5)) to no avail.
>
> I really need this capability, because I am using the view metadata to
> generate JDBC code. With a specified precision and scale I can generate
Java
> native datatypes. With an unspecified precision, I have to resort to
> generating BigDecimal Java class instances. I prefer using native Java
> datatypes because of their performance advantage over Java class
instances.
>
> Does anyone know how to explicitly set a view column's datatype?
>
> Later,
> BEDick
>
> OS: Win2K
> Oracle: 9.2.0.4
>
> Example:
>
> ORA> create or replace view foo
> 2 as
> 3 select 1 * rownum an_expression
> 4 from dual;
>
> View created.
>
> ORA> desc foo
> Name Null? Type
> ----------------------------- -------- --------------------
> AN_EXPRESSION NUMBER
>
> ORA> create or replace view foo
> 2 as
> 3 select cast(1 * rownum as number(5)) an_expression
> 4 from dual
>
> View created.
>
> ORA> desc foo
> Name Null? Type
> ----------------------------- -------- --------------------
> AN_EXPRESSION NUMBER
>
>
>
Received on Thu Jan 29 2004 - 20:42:46 CST

Original text of this message

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