Sending an Email with a cursor that returns multiple fields.
881721Aug 11 2011 — edited Aug 18 2011I was investigating about sending emails from apex, and I'd like to know if you can help me, I need to send an Email report with multiple fields, I m using this code :
DECLARE
CURSOR c1 is
select id,gk,creation_date,sr_count,issue_notes,sr_impacted,oldest_creation_date
from gk_report where id = (select max(id) from gk_report);
reg c1%ROWTYPE;
begin
IF (c1%ISOPEN = TRUE) THEN
CLOSE c1;
END IF;
OPEN c1;
FETCH c1 INTO reg;
CLOSE c1;
APEX_MAIL.send(
p_to => 'MICC_MANAGEMENT_SCL_WW@ORACLE.COM',
p_from => 'MICC_MANAGEMENT_SCL_WW@ORACLE.COM',
p_body => 'Hourly GK Log',
p_body_html =>
'GK: '||to_char(reg.gk)||'<br>
CREATION DATE: '||to_char(reg.CREATION_DATE,'DD-MON-YYYY HH24:MI:SS')||'<br>
SR COUNT: '||to_char(reg.SR_COUNT)||'<br>
ISSUE NOTES: '||to_char(reg.ISSUE_NOTES)||'<br>
SRs IMPACTED: '||to_char(reg.SR_IMPACTED)||'<br>
OLDEST CREATION DATE: '||to_char(reg.OLDEST_CREATION_DATE,'DD-MON-YYYY HH24:MI:SS'),
p_SUBJ => 'Hourly GK Log: ' || to_char(reg.CREATION_DATE,'DD-MON-YYYY HH24:MI:SS'),
p_cc => NULL,
p_bcc => NULL ,
p_replyto => NULL
);
end;
In this code there is a cursor that returns just one field, But what about if the cursor returns multiple fields, How can I insert a Loop into this code.?
Thanks,
Pablo.