| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Create view
Use CAST and column alias:
create table t2
( name character ( 50) , telephone character ( 50) , address character (150))
INSERT INTO t2 (name, telephone, address) VALUES
('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBbbb'
,'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCcc')
CREATE VIEW v AS
SELECT
CAST(name AS character(30)) AS username ,CAST(telephone AS character(50)) AS usephone ,CAST(address AS character varying (100)) AS useradrFROM t2
SELECT * FROM v
-- Tibor Karaszi "K.Y. Fung" <kyfung_at_hotmail.com> wrote in message news:c22bb40d.0210010624.16284872_at_posting.google.com...Received on Tue Oct 01 2002 - 09:43:25 CDT
> How to create a view which have different data type and column length
> from the original base table?
>
> For example, the base table consists of:
>
> name character 50
> telephone character 50
> address character 150
>
> the view should have columns:
>
> username character 30
> userphone character 20
> useraddr character varying 100
>
> Regards,
> K.Y. Fung
![]() |
![]() |