
select count(*) from promv;
select count(*) 
from promv s,promotion d
where s.P_PROMO_ID=d.P_PROMO_ID;

SET SERVEROUTPUT ON;
DECLARE
   max_sk NUMBER;
BEGIN
  FOR p_rec IN (SELECT P_PROMO_ID
,P_START_DATE_SK
,P_END_DATE_SK
,P_COST
,P_RESPONSE_TARGET
,P_PROMO_NAME
,P_CHANNEL_DMAIL
,P_CHANNEL_EMAIL
,P_CHANNEL_CATALOG
,P_CHANNEL_TV
,P_CHANNEL_RADIO
,P_CHANNEL_PRESS
,P_CHANNEL_EVENT
,P_CHANNEL_DEMO
,P_CHANNEL_DETAILS
,P_PURPOSE
,P_DISCOUNT_ACTIVE
                   FROM promv) LOOP
    update promotion set 
 P_END_DATE_SK=p_rec.P_END_DATE_SK
,P_COST=p_rec.P_COST
,P_RESPONSE_TARGET=p_rec.P_RESPONSE_TARGET
,P_PROMO_NAME=p_rec.P_PROMO_NAME
,P_CHANNEL_DMAIL=p_rec.P_CHANNEL_DMAIL
,P_CHANNEL_EMAIL=p_rec.P_CHANNEL_EMAIL
,P_CHANNEL_CATALOG=p_rec.P_CHANNEL_CATALOG
,P_CHANNEL_TV=p_rec.P_CHANNEL_TV
,P_CHANNEL_RADIO=p_rec.P_CHANNEL_RADIO
,P_CHANNEL_PRESS=p_rec.P_CHANNEL_PRESS
,P_CHANNEL_EVENT=p_rec.P_CHANNEL_EVENT
,P_CHANNEL_DEMO=p_rec.P_CHANNEL_DEMO
,P_CHANNEL_DETAILS=p_rec.P_CHANNEL_DETAILS
,P_PURPOSE=p_rec.P_PURPOSE
,P_DISCOUNT_ACTIVE=p_rec.P_DISCOUNT_ACTIVE
  where P_PROMO_ID=p_rec.P_PROMO_ID;
  END LOOP;
commit;
END;

.

run;
