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

Re: Repost: Setting view column datatype

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Thu, 05 Feb 2004 23:04:14 -0800
Message-ID: <1076051001.430759@yasure>


Brian Dick wrote:

> Doesn't work. But thanks anyways. Here is the example from my original post
> again. Notice that the column datatype of the view is NUMBER when it should
> be NUMBER(5).
>
> 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
>

I think this may be generic to the NUMBER data type and views:

CREATE OR REPLACE VIEW foo AS
SELECT CAST(1 * rownum as VARCHAR2(5)) an_expression FROM dual;

QL> desc foo

Name                                      Null?    Type
----------------------------------------- -------- -----------
AN_EXPRESSION                                      VARCHAR2(5)

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Fri Feb 06 2004 - 01:04:14 CST

Original text of this message

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