How to change the field type in Oracle?

To modify the data type of a field in an Oracle database, you can use the ALTER TABLE statement. Here is an example:

ALTER TABLE table_name
MODIFY column_name new_data_type;

In this statement, table_name refers to the name of the table to be modified, column_name refers to the name of the field to be modified, and new_data_type refers to the new data type to be changed to.

For example, if you want to change the data type of a field in a table from VARCHAR2 to NUMBER, you can use the following statement:

ALTER TABLE employees
MODIFY salary NUMBER;
Leave a Reply 0

Your email address will not be published. Required fields are marked *