Friday, January 29, 2010

Generating rows using level keyword

A nice way of generating rows using level keyword.

with t as
(select 'Hello hi' stri
from dual
)
select substr(stri, i, 1)
from t
, (select level i
from t
connect by level <= length(t.stri)
)

or

with strr as
(select 'Hello Hi' str from dual)
select level,substr(str,level,1) from strr
connect by level

No comments: