Please can someone help me with a Unix loop that calls Oracle PL/SQL code (below) and when done for each iteration to then mail each row to corresponding e-mail address.
Many thanks
SET HEADING ON
SET SERVEROUTPUT ON
SPOOL c:\tony\xxx.csv
DECLARE
c_delimiter CONSTANT VARCHAR2(1) := ',';
CURSOR cur_emp IS
SELECT empno
,ename
,deptno
,email
FROM scott.emp;
BEGIN
DBMS_OUTPUT.PUT_LINE('EMPNO, ENAME, DEPTNO');
FOR rec_emp IN cur_emp LOOP
DBMS_OUTPUT.PUT_LINE(rec_emp.empno
|| c_delimiter
|| rec_emp.ename
|| c_delimiter
|| rec_emp.deptno);
--Intentionally commented this out as it is impossible within pl/sql code BUT that is my challenge - to send individual email per row*/
-- SPOOL OFF
--!mailx -s 'XYX1234 screen changes' rec_emp.email < XYZ1234 screen changes.txt
END LOOP;
END;
/
SPOOL OFF
EXIT