create table TEST_NAME (a varchar2(5),B varchar2(10));
create table test_name1 (a varchar2(8),b varchar2(7));
insert into TEST_NAME values("Radha","hyderabad");
insert into TEST_NAME values("satya","warangal");
I have info like this.
Now i want to insert TEST_NAME table data into TEST_NAME1.Here both the tables having 2 columns but length of the columns are different.
How can i insert same data in another table with out changing size of table columns.
Someone asked me this question.I tried but didn"t get solution.
Anyone please help
It is not possible to insert data with out changing size of columns.
But there is a trick in asking this question.
By your create statements it is very clear that both the table size is same. Column size only different.
So we can add data from both the columns and divide data based on destination table column sizes.
insert into TEST_NAME1 select a||substr(b,1,3),substr(b,4) from TEST_NAME;
It will insert like below