Home > database >  Oracle character conversion numeric (existing data)
Oracle character conversion numeric (existing data)

Time:10-02

Such as title, direct Varchar2 to Number in the table structure is not possible, is there any way in the presence of data modification type (some fields blank)

CodePudding user response:

A new table, transferred to the new table, delete the old table, had its name changed

CodePudding user response:

Assume that the original column names for C1, type varchar

1. Add new columns C2, type integer,
2. Update the C2 values for C1, such as conversion fails, you need to check the data,
3. Will update C1 column is null,
4. Modify the C1 type integer,
5. Will update to the value of C1 C2,
6. Remove the C2,

CodePudding user response:

Add new column...

CodePudding user response:

refer to the second floor wmxcn2000 response:
assumes that the original column names for C1, type varchar

1. Add new columns C2, type integer,
2. Update the C2 values for C1, such as conversion fails, you need to check the data,
3. Will update C1 column is null,
4. Modify the C1 type integer,
5. Will update to the value of C1 C2,
6. Remove the C2,
moderator said is what I usually do, different is that I usually have a list of empty as backup column (or columns),

CodePudding user response:

Rebuild a table, the corresponding field name, data import again
  • Related