DECLARE
TESTEMAIL VARCHAR2(100);
TESTNAME VARCHAR2(100);
EMAIL_LIST VARCHAR2(100);
EMAIL_NAME VARCHAR2(100);
EMAIL_COUNT NUMBER;
START_PT NUMBER;
--:P5_START NUMBER;
--:P5_NUMBER NUMBER;
BEGIN
EMAIL_COUNT := :P5_START + :P5_NUMBER;
START_PT := :P5_START;
-- SELECT COUNT(*) INTO EMAIL_COUNT FROM TEST_EMAIL;
FOR i IN START_PT..EMAIL_COUNT
LOOP
SELECT TESTEMAIL INTO EMAIL_LIST FROM TEST_EMAIL WHERE ID = i;
SELECT TESTNAME INTO EMAIL_NAME FROM TEST_EMAIL WHERE ID = i;
APEX_MAIL.SEND(
p_to => EMAIL_LIST ,
p_from => 'admin@solatoz.com',
p_subj => :P5_SUBJECT,
p_body => 'Please Check email.',
p_body_html => 'Dear' || ' '|| EMAIL_NAME || ',' || :P5_BODY
);
END LOOP;
END;