How to alter column size of a view in Oracle

后端 未结 2 1267
花落未央
花落未央 2021-01-24 02:58

I am trying to alter the column size of a view with the same command that we use for table like :

alter table 
STUDENT
modify (
    ROLL_NO VARCHAR2(80)
);
         


        
2条回答
  •  心在旅途
    2021-01-24 03:53

    A view is simply saved query and "inherits" column type from underlying base table. So if you need to change metadata you should alter view definition:

    ALTER VIEW view_students
    AS
    SELECT CAST(roll_no AS VARCHAR2(80)) AS roll_no,
         ...
    FROM tab_students;
    

    If you want to change data type to store longer strings, then you need to locate base table and alter it instead:

    ALTER VIEW tab_students
    MODIFY (ROLL_NO VARCHAR2(80));
    

提交回复
热议问题