today:
381
yesterday:
590
Total:
1,737,534

Technology

email - PL/SQL

admin 2019.10.24 08:30 Views : 367

DECLARE 

 

R NUMBER;

CUS_EMAIL VARCHAR2(100);

CUS_NAME VARCHAR2(100);

P12_START NUMBER;

P12_END NUMBER;

EMAIL_START NUMBER;

EMAIL_END NUMBER;

 

BEGIN

EMAIL_START := :P5_START;

EMAIL_END := :P5_END;

 

 FOR i IN EMAIL_START..EMAIL_END

 

LOOP 

SELECT R,CUSTOMER_NAME,CUSTOMER_EMAIL INTO R,CUS_NAME,CUS_EMAIL FROM 

   (SELECT CUSTOMER_ID,CUSTOMER_NAME,CUSTOMER_EMAIL,CUSTOMER_STATE, ROW_NUMBER() OVER 

    (ORDER BY CUSTOMER_STATE) R FROM CUSTOMERS WHERE UPPER(CUSTOMER_STATE) = UPPER(:P5_STATE))

   WHERE R = i;

 

    APEX_MAIL.SEND( 

    p_to => CUS_EMAIL , 

    p_from => 'js@buxomcurvy.com', 

    p_subj => :P5_SUBJECT, 

    p_body => 'Please Check email.', 

    p_body_html => 'Dear' || '  '|| CUS_NAME || ',' || :P5_BODY 

    );

APEX_MAIL.PUSH_QUEUE;  

END LOOP;

 

END;