create or replace procedure test_proc_cursor(acursor out sys_refcursor) is
l_sql1 varchar2(200);
l_sql2 varchar2(200);
begin
l_sql1 := '
select *
from (
select extnbr,substr(rdate,1,6) rmnth,telamt from tel_tbl_cdr where rdate like ''2010%''
)
pivot (sum(telamt) for rmnth in (';
l_sql2 := '''201001'',''201002'',''201003'',''201004'',''201005'',''201006'',
''201007'',''201008'',''201009'',''201010'',''201011'',''201012''';
open acursor for l_sql1||l_sql2||'))';
end test_proc_cursor;
沒有留言:
張貼留言