today:
432
yesterday:
719
Total:
1,770,216

Technology

SEND CODE :P12

admin 2018.12.13 21:25 Views : 345

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 := :P12_START;

EMAIL_END := :P12_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(:P12_STATE))

   WHERE R = i;

 

    APEX_MAIL.SEND( 

    p_to => CUS_EMAIL , 

    p_from => 'jim@stylebanc.com', 

    p_subj => :P12_SUBJECT, 

    p_body => 'Please Check email.', 

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

    );

 

END LOOP;

 

END;