Last active
August 29, 2015 13:58
-
-
Save xtender/9998182 to your computer and use it in GitHub Desktop.
listagg-model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with t1 as (select level id from dual connect by level<=10) | |
,t2 as (select level id, 'a'||level v from dual connect by level<=10) | |
select | |
id, | |
(select rtrim(new_v,',') | |
from t2 | |
where t2.id<=t1.id | |
model | |
return updated rows | |
dimension by (rownum rn) | |
measures(cast(null as varchar2(4000)) new_v, v) | |
rules iterate(1e6) until(presentv(new_v[iteration_number+2],1,0)=0) | |
( | |
new_v[0]=new_v[0]||v[iteration_number+1]||',' | |
) | |
) | |
from t1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment