Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var xrefc refcursor;
DECLARE
v_str VARCHAR2(10000) := 'SELECT JOB';
BEGIN
FOR x IN (SELECT DISTINCT deptno
FROM emp
ORDER BY 1)
LOOP
v_str := v_str
||Chr(10)
||','
||'SUM(DECODE(E.DEPTNO,'''
||x.deptno
||''',e.sal,0)) AS "'
||x.deptno
||'"';
END LOOP;
v_str := v_str
||Chr(10)
||'FROM EMP E'
||Chr(10)
||'GROUP BY JOB ORDER BY JOB';
dbms_output.Put_line(v_str);
OPEN :xrefc FOR v_str;
END;
/
print :xrefc