2 Replies Latest reply: Apr 21, 2013 10:48 PM by 899401 RSS

    increase datatype

    899401
      Hi,
      How to increase datatype of the column which already has data i.e. varchar 10 to 25 bytes

      please help with the steps

      thanks
        • 1. Re: increase datatype
          sb92075
          SQL> create table fubar (col1 varchar2(10));
          
          Table created.
          
          SQL> insert into fubar values('yes');
          
          1 row created.
          
          SQL> commit;
          
          Commit complete.
          SQL> alter table fubar modify (col1 varchar2(25));
          
          Table altered.
          
          SQL> 
          Handle:     896398
          Status Level:     Newbie
          Registered:     Nov 9, 2011
          Total Posts:     605
          Total Questions:     177 (133 unresolved)


          I extend my condolences to you since you rarely get answers to your questions here.
          • 2. Re: increase datatype
            rp0428
            >
            How to increase datatype of the column which already has data i.e. varchar 10 to 25 bytes
            >
            Use an ALTER TABLE MODIFY statement

            See ALTER TABLE in the SQL Language doc
            http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_3001.htm
            >
            modify_col_properties

            Use this clause to modify the properties of the column. Any of the optional parts of the column definition (datatype, default value, or constraint) that you omit from this clause remain unchanged.
            . . .
            You can always increase the size of a character or raw column or the precision of a numeric column, whether or not all the rows contain nulls. You can reduce the size of a datatype of a column as long as the change does not require data to be modified.The database scans existing data and returns an error if data exists that exceeds the new length limit.