Q:

Dynamically convert row into columns based on the content in the cell in SQL Server & Oracle

Using procedure i am trying to achieve below use case. Can someone please guide me. 
Here is the data which is present in a table 
Source Table : 

ID  | attendance |
------------------
123 | MTW
124 | TW
------------------

Target Table :

ID  | attendance
-----------------
123 | M
123 | T
123 | W
124 | T
124 | W
-----------------

A:

Try this in Oracle.
select id, substr(attendance, level, 1) attendance
from   yourtable
connect by level <= LENGTH(attendance) and
prior id = id and
           prior sys_guid() is not null;

DEMO

A:

You can use CONNECT BY comparing the length of the varchar
SQL Fiddle
Oracle 11g R2 Schema Setup:
select * from dual

Query 1:
with tab(id,att) as (
  select 123, 'MTW' from dual union
  select 124, 'TW' from dual
) select distinct id, substr(att, level-1, 1) a from tab t
connect by (level-1) <= LENGTH(att) 
order by id

**[Results][2]**:
    |  ID | A |
    |-----|---|
    | 123 | M |
    | 123 | T |
    | 123 | W |
    | 124 | T |
    | 124 | W |

