원래 사용가능한데.. function에서 왜 그럴까요. 가끔 procedure나 function 컴파일할 때 syntax오류가 나는데요.
그럴 때는 동적쿼리로 변경해서 사용하시면 됩니다. 맛점요.
declare var_col varchar2(10); type cs is ref cursor; cur cs; squery varchar2(300) := 'select to_char(wm_concat(distinct col)) col from ( select 1 col from dual union all select 2 col from dual union all select 3 col from dual union all select 3 col from dual )'; begin open cur for squery; loop fetch cur into var_col; exit when cur%notfound; dbms_output.put_line(var_col); end loop; end;
그게 아니면 그냥 쿼리를 바꾸시구요.
cursor reg_seek is select wm_concat(p_payment) p_payment from (select distinct p_payment from a );