Search code examples
sqloracle-databaseplsqloracle11galter

Need ALTER TYPE query to update a existing field in existing object


I have already created a TYPE object Example1 using the following query

CREATE OR replace type example1 AS OBJECT (
   emp_name varchar2(32),
   emp_location varchar2(32)
);

Now I want to increase the emp_location's length to varchar2(50) from varchar2(32)

I have tried different ALTER TYPE command and it is not working.

Can someone provide the correct syntax to update the value?


Solution

  • Use alter type <<type_name>> modify attribute statement.

    alter type example1 modify attribute emp_location varchar2(50);
    

    Find out more