Pkr
Pkr

Reputation: 31

I've some 40,000 records in my table and I want to remove the last to digits for all the records in a column

My data is like below :

2272522520
2272523235
2272525435
2272525437
2272525439
2272525443
2272525444
2272551733

I want to remove the last digit for all the rows in that column. Can anyone please help. Thanks in advance!

Upvotes: 1

Views: 38

Answers (1)

Marcin Wroblewski
Marcin Wroblewski

Reputation: 3571

If your column is of number type:

update your_table
set your_column = trunc(your_column/10);

If it's varchar2:

update your_table
set your_column = substr(your_column, 1, length(your_column)-1);

Upvotes: 2

Related Questions