You can do it PL/SQL procedure.
Or
You can do it in the following method:
PHP Code:
SQL> select * from t1 ;
ID SOMEX
---------- ------------------------------
1 ABCD
2 ABCDEF
SQL> select *
2 from ( select id, substr(somex,1,2)
3 from t1 where substr(somex,1,2) is not null
4 union all
5 select id, substr(somex,3,2)
6 from t1 where substr(somex,3,2) is not null
7 union all
8 select id, substr(somex,5,2)
9 from t1 where substr(somex,5,2) is not null)
10 ;
ID SU
---------- --
1 AB
1 CD
2 AB
2 CD
2 EF
SQL> spool off
Note: If the SOMEX col is too big, then you have to write many union
all statement.
Tamil
Bookmarks