Re: How can view keep columns from dictionary
Date: Wed, 15 Jul 2020 17:40:55 -0400
Message-ID: <CAP79kiSFYVOV81tA_GPdP+09fGyE=Fh=Um-gHLx52ndTs8v2Ow_at_mail.gmail.com>
You can use DBA_TAB_COLUMNS to see the columns of a view. Remember a view is two parts under the covers. Column Definition of the View plus the SQL text for the data portion of the view.
create table test_tbl
(val1 number, val2 number)
/
create view test_vw
as
select * from test_tbl
/
alter table test_tbl
add val3 number
/
select * from test_vw
/
select column_name, column_id
from dba_tab_columns
where table_name = 'TEST_VW'
order by column_id
/
View DDL:
CREATE OR REPLACE FORCE VIEW CTAYLOR.TEST_VW
(
VAL1,
VAL2
)
BEQUEATH DEFINER
AS
SELECT "VAL1", "VAL2" FROM test_tbl;
On Wed, Jul 15, 2020 at 5:26 PM Eriovaldo Andrietta <ecandrietta_at_gmail.com> wrote:
> Hello,
>
> I have a doubt about this code :
>
> drop table test;
> create table test
> (col1 number,
> col2 number);
>
> create view vtest
> as
> select * from test;
>
> select * from vtest; -- 2 columns
>
> alter table test add col3 number; -- here table has 3 columns
>
> select * from vtest; -- view keeps using 2 columns
>
> Is there a way to retrieve the current columns from table when
> created view as select * from table withou change the view ?
>
> Regards
> Eriovaldo
>
>
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Jul 15 2020 - 23:40:55 CEST